Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

atv

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atv

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ATV: Ascii Table Values

ATV is a reader for data in ascii table format. It allows you to read data formatted like this:

|------------------+--------------------|
| name             | dob                |
|------------------+--------------------|
| Malcolm Reynolds | September 20, 2468 |
|------------------+--------------------|
| Zoe Washburne    | February 15, 2484  |
|------------------+--------------------|

or, without separators, like this:

|------------------+--------------------|
| name             | dob                |
|------------------+--------------------|
| Malcolm Reynolds | September 20, 2468 |
| Zoe Washburne    | February 15, 2484  |
|------------------+--------------------|

In Ascii Tables For Clearer Testing I discuss using ascii tables to improve comprehension of software tests.

This gem was originally created when I worked at Indiegogo. Indiegogo has graciously transferred ownership of the gem to me so that I can maintain it going forward.

Installation

Add this line to your application's Gemfile:

gem 'atv'

And then execute:

$ bundle

Or install it yourself as:

$ gem install atv

Usage

Rows are returned or yielded as CSV::Row objects.

|-----------------------+------------------------------+-----------------------------------|
| **Ascii Table Value** | **Returned Value**           | **Notes**                         |
|-----------------------+------------------------------+-----------------------------------|
| Malcolm Reynolds      | "Malcolm Reynolds"           | Most values returned as string    |
|-----------------------+------------------------------+-----------------------------------|
| 123                   | "123"                        | including numbers                 |
|-----------------------+------------------------------+-----------------------------------|
| wrapped strings are   | "wrapped strings are folded" | Similar to yaml, wrapped          |
| folded                |                              | strings are folded with a single  |
|                       |                              | space replacing the new line      |
|-----------------------+------------------------------+-----------------------------------|
|                       | nil                          | The CSV::Row object will have nil |
|                       |                              | for blank values                  |
|-----------------------+------------------------------+-----------------------------------|
| null                  | nil                          | null, true, and false are         |
|                       |                              | special values                    |
|-----------------------+------------------------------+-----------------------------------|
| true                  | true                         |                                   |
|-----------------------+------------------------------+-----------------------------------|
| false                 | false                        |                                   |
|-----------------------+------------------------------+-----------------------------------|
#| commented rows        | not included                 | As you would expect, commented    |
#|                       |                              | rows are not included             |
#|-----------------------+------------------------------+-----------------------------------|

Reading a String

atv = ATV.from_string(string)
atv.each do |row|
  # use row here...
end

Reading from am IO object

atv = ATV.new(io)
atv.each do |row|
  # use row here...
end

More examples can be found in the Examples of Testing With ASCII Tables repo.

Contributing

  1. Fork it ( https://github.com/kellyfelkins/atv )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 04 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc