Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.
/ ltsv Public archive

Reader/Writer library for the LTSV(Labeled Tab Separated Values) format

License

Notifications You must be signed in to change notification settings

kachick/ltsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • This repository is archived
  • No longer maintained
  • All versions have been yanked from https://rubygems.org for releasing valuable namespace for others

ltsv

Build Status

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

  • Ruby - 3.1 or higher

License

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

About

Reader/Writer library for the LTSV(Labeled Tab Separated Values) format

Topics

Resources

License

Stars

Watchers

Forks

Languages