ltsv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -60,6 +60,14 @@ Current limitation: parsed string should be in one line. If you include any spec
60
60
 
61
61
  Dumped objects should respond to :to_hash.
62
62
 
63
+ ### Author and Contributors
64
+
65
+ * Author
66
+ * Naoto "Kevin" IMAI TOYODA <condor1226@github.com>
67
+
68
+ * Contributors
69
+ * Naoto SHINGAKI <https://github.com/naoto/>
70
+
63
71
  ## Contributing
64
72
 
65
73
  1. Fork it
@@ -0,0 +1,12 @@
1
+ #History
2
+ ----
3
+
4
+ 0.0.2 (2013/02/08)
5
+ ------------------
6
+ Fixed a bug with :parse method for handling an IO argument. (Thanks to Naoto SINGAKI <https://github.com/naoto/>)
7
+
8
+ ----
9
+
10
+ 0.0.1 (2013/02/07)
11
+ ------------------
12
+ Initial Release.
@@ -4,7 +4,7 @@
4
4
  #
5
5
  #
6
6
  module LTSV
7
- VERSION = "0.0.1"
7
+ VERSION = "0.0.2"
8
8
 
9
9
  # Parsing given stream or string.
10
10
  # If you specified a stream as the first argument,
@@ -28,7 +28,7 @@ module LTSV
28
28
  when String
29
29
  parse_string(io_or_string, options)
30
30
  when IO
31
- parse_io(io_or_string = {})
31
+ parse_io(io_or_string, options)
32
32
  end
33
33
  end
34
34
 
@@ -86,7 +86,7 @@ module LTSV
86
86
  private
87
87
 
88
88
  def parse_io(io, options)#:nodoc:
89
- io.map{|l|parse_string l, options}
89
+ io.map{|l|parse_string l.chomp, options}
90
90
  end
91
91
 
92
92
  def parse_string(string, options)#:nodoc:
@@ -35,6 +35,16 @@ describe LTSV do
35
35
  {:label1 => nil, :label2 => 'value2'}
36
36
  end
37
37
  end
38
+
39
+ context 'IO argment' do
40
+ it 'can parse labeled tab separated values into file' do
41
+ LTSV.parse(File.open("#{File.dirname(__FILE__)}/test.ltsv")).should ==
42
+ [{:label1 => 'value1', :label2 => 'value\\nvalue'},
43
+ {:label3 => 'value3', :label4 => 'value\\rvalue'},
44
+ {:label5 => 'value5', :label6 => 'value\\tvalue'},
45
+ {:label7 => 'value7', :label8 => 'value\\\\value'}]
46
+ end
47
+ end
38
48
  end
39
49
 
40
50
  describe :load do
@@ -0,0 +1,4 @@
1
+ label1:value1 label2:value\\nvalue
2
+ label3:value3 label4:value\\rvalue
3
+ label5:value5 label6:value\\tvalue
4
+ label7:value7 label8:value\\\\value
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ltsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -39,10 +39,12 @@ files:
39
39
  - LICENSE.txt
40
40
  - README.md
41
41
  - Rakefile
42
+ - ReleaseNote.md
42
43
  - lib/ltsv.rb
43
44
  - ltsv.gemspec
44
45
  - spec/ltsv_spec.rb
45
46
  - spec/spec_helper.rb
47
+ - spec/test.ltsv
46
48
  homepage: https://github.com/condor/ltsv
47
49
  licenses: []
48
50
  post_install_message:
@@ -70,3 +72,4 @@ summary: A Parser / Dumper for LTSV
70
72
  test_files:
71
73
  - spec/ltsv_spec.rb
72
74
  - spec/spec_helper.rb
75
+ - spec/test.ltsv