tabreader 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/tabreader/reader.rb +23 -0
- data/lib/tabreader/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '093433817ddd93e79af07604a115964639269b2a'
|
4
|
+
data.tar.gz: 85d0c1333b75670230133e73f91cda27c1bb68ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c254861cd86e97d23b7f020d9a1323314b036964f3b14551da66f8e6f4c2948ea6c6874b3121c82f34070c13606f4631721d532408899a0393064311dcc71ff
|
7
|
+
data.tar.gz: 9baa9df8979c3eb1923c31ae4344e57926f4c1e431c3d6c4b7567e92cf5bbf9348e55b08756e04cc2a98cfd5978f0c12792d17fb6d713525ab80d008ae2511d5
|
data/README.md
CHANGED
@@ -52,8 +52,8 @@ pp records
|
|
52
52
|
TabReader.foreach( "values.tab" ) do |rec|
|
53
53
|
pp rec
|
54
54
|
end
|
55
|
-
|
56
|
-
|
55
|
+
# => ["1","2","3"]
|
56
|
+
# => ["5","6","7"]
|
57
57
|
```
|
58
58
|
|
59
59
|
|
@@ -171,7 +171,7 @@ Here is a quick grammar in Backus-Naur Form (BNF):
|
|
171
171
|
```
|
172
172
|
field ::= [character]+ # multiple characters
|
173
173
|
record ::= field [TAB field]+ EOL # at least one field, or more
|
174
|
-
|
174
|
+
datafile ::= record+
|
175
175
|
```
|
176
176
|
|
177
177
|
Example:
|
data/lib/tabreader/reader.rb
CHANGED
@@ -112,3 +112,26 @@ def self.header( path )
|
|
112
112
|
end
|
113
113
|
|
114
114
|
end # class TabReader
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
class TabHashReader
|
120
|
+
|
121
|
+
def self.read( path, headers: true )
|
122
|
+
TabReader.read( path, headers: headers )
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.parse( txt, headers: true )
|
126
|
+
TabReader.parse( txt, headers: headers )
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.foreach( path, headers: true, &block )
|
130
|
+
TabReader.foreach( path, headers: headers, &block )
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.header( path ) ## add header too? why? why not?
|
134
|
+
TabReader.header( path )
|
135
|
+
end
|
136
|
+
|
137
|
+
end # class TabHashReader
|
data/lib/tabreader/version.rb
CHANGED