Skip to content
Ruby parsers for text file formats.
Ruby
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
lib API changes, implement Enumerable, deprecate #data Aug 23, 2019
scripts Refactor glossary test script Aug 18, 2019
spec API changes, implement Enumerable, deprecate #data Aug 23, 2019
.gitignore Now Yard is my best friend Aug 18, 2019
.rspec Tablatal Aug 14, 2019
.rubocop.yml Make string normalization methods public Aug 22, 2019
.rubocop_todo.yml [Rubocop] RSpec/SharedExamples Aug 21, 2019
.ruby-version Require Ruby >= 2.5.0 Aug 17, 2019
.travis.yml Update .travis.yml Aug 17, 2019
.yardopts Remove source code listings from docs Aug 22, 2019
CHANGELOG.md API changes, implement Enumerable, deprecate #data Aug 23, 2019
Gemfile Add rubocop-performance & rubocop-rspec Aug 21, 2019
LICENSE Initial commit Aug 14, 2019
README.md Update README.md Aug 20, 2019
Rakefile Now Yard is my best friend Aug 18, 2019
nodaire.gemspec Link to documentation Aug 18, 2019

README.md

Nodaire Gem Version Build Status

Nodaire is a collection of text file parsers. It supports Ruby 2.5.0 or greater.

Note: This is a new gem, and the interface is not yet stable. Expect breaking API changes before v1.0.0 is released.

File formats

Nodaire currently supports the following text file formats:

Install

Install nodaire from RubyGems:

gem install nodaire

Documentation

Code documentation is available.

Keep reading below for examples of how to use Nodaire.

Usage examples

Indental

require 'nodaire/indental'

doc = Nodaire::Indental.parse! <<~NDTL
  NAME
    KEY : VALUE
    LIST
      ITEM1
      ITEM2
NDTL

doc.valid?     # true
doc.categories # ["NAME"]
doc.to_h       # {"NAME"=>{"KEY"=>"VALUE", "LIST"=>["ITEM1", "ITEM2"]}}
doc.to_json    # '{"NAME":{"KEY":"VALUE","LIST":["ITEM1","ITEM2"]}}'

Tablatal

require 'nodaire/tablatal'

doc = Nodaire::Tablatal.parse! <<~TBTL
  NAME    AGE   COLOR
  Erica   12    Opal
  Alex    23    Cyan
  Nike    34    Red
  Ruca    45    Grey
TBTL

doc.valid?    # true
doc.keys      # ["NAME", "AGE", "COLOR"]
doc.to_a.last # {"NAME"=>"Ruca", "AGE"=>"45", "COLOR"=>"Grey"}
doc.to_csv    # "NAME,AGE,COLOR\nErica,12,Opal\nAlex,23,..."

Development

To run the latest source code, check out the Git repository:

git clone https://github.com/slisne/nodaire.git

Install the dependencies using Bundler:

gem install bundler
bundle install

Analyse the code and run unit tests using Bundler:

bundle exec rake rubocop
bundle exec rake spec
You can’t perform that action at this time.