Skip to content
An reader/writer library for the LTSV(Labeled Tab Separated Values) format.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
lib
spec
.gitignore
.travis.yml
.yardopts
Gemfile
MIT-LICENSE
README.md
Rakefile
ya_ltsv.gemspec

README.md

ltsv

Build Status Gem Version

Description

An reader/writer library for the LTSV(Labeled Tab Separated Values) format. See LTSV specs http://ltsv.org/.

Usage

require 'ltsv'

LTSV.parse_line "key1:val1	key2:val2\n" #=> {:key1=>"val1", :key2=>"val2"}

LTSV.parse 'key1:val1	key2:val2
key1:val1	key2:val2	key3:val3' #=> [{:key1=>"val1", :key2=>"val2"}, {:key1=>"val1", :key2=>"val2", :key3=>"val3"}]

LTSV.foreach foo.log.ltsv do |entry|
  p entry # calls the block with parsed hash
end

LTSV.for_io STDIN do |entry|
  p entry # calls the block with parsed hash
end

LTSV.line_from_hash({:key1=>"val1", :key2=>"val2"}) #=> "key1:val1	key2:val2"
LTSV.line_from_hash valid: "with\ttab" #=> LTSV::MalformedDataError

Requirements

Install

gem install ya_ltsv

Link

License

The MIT X11 License
Copyright (c) 2013 Kenichi Kamiya
See MIT-LICENSE for further details.

You can’t perform that action at this time.