Nodaire
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 supports the following text file formats:
File format | Documentation and examples | Origin |
---|---|---|
Indental | Nodaire::Indental |
https://wiki.xxiivv.com/#indental |
Tablatal | Nodaire::Tablatal |
https://wiki.xxiivv.com/#tablatal |
Install
Install nodaire
from RubyGems:
gem install nodaire
Documentation
Code documentation is available.
Keep reading below for examples of how to use Nodaire.
Usage example
require 'nodaire/indental'
source = <<~NDTL
NAME
KEY : VALUE
LIST
ITEM1
ITEM2
NDTL
doc = Nodaire::Indental.parse(source)
doc.valid?
#=> true
doc.categories
#=> ["NAME"]
doc['NAME']['KEY']
#=> "VALUE"
doc.to_h
#=> {"NAME" => {"KEY"=>"VALUE", "LIST"=>["ITEM1", "ITEM2"]}}
doc.to_json
#=> '{"NAME":{"KEY":"VALUE","LIST":["ITEM1","ITEM2"]}}'
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