text-data-tools 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/text-data-tools.rb +9 -7
- data/text-data-tools.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/lib/text-data-tools.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module TextDataTools
|
3
3
|
# Return a one-dimensional array containing data from the file filename,
|
4
|
-
#
|
4
|
+
# which may or may not have a line of column headers,
|
5
5
|
# in the column column_header, where column_header maybe either a string
|
6
6
|
# or a regex which matches the title of the column, or an integer
|
7
7
|
# giving the zero-based column number.
|
@@ -38,12 +38,12 @@ module TextDataTools
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# Return a two-dimensional array containing data from the file filename,
|
41
|
-
#
|
41
|
+
# which may or may not have a line of column headers,
|
42
42
|
# in the column column_header, where column_header maybe either a string
|
43
43
|
# or a regex which matches the title of the column, or an integer
|
44
44
|
# giving the zero-based column number.
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# It is assumed that two-dimensional array is in one column.
|
47
47
|
# If index_header is nil, data is assumed to be separated by blank lines.
|
48
48
|
# E.g.
|
49
49
|
# 1.2
|
@@ -153,10 +153,12 @@ module TextDataTools
|
|
153
153
|
column_header = index_array.index(index_array.compact[0])
|
154
154
|
end
|
155
155
|
|
156
|
-
#
|
157
|
-
#
|
158
|
-
#
|
159
|
-
#
|
156
|
+
# This is a simple class which can interface with the methods of TextFileTools
|
157
|
+
# to prevent the user having to specify the file name and other properties of the
|
158
|
+
# data file for every call. In a
|
159
|
+
# nutshell, create a new instance of this class giving it the filename, and any
|
160
|
+
# appropriate options,
|
161
|
+
# then call methods from TextFileTools omitting the appropriate arguments.
|
160
162
|
class TextDataFile
|
161
163
|
def initialize(filename, has_header_line = false, match = /\S+/, header_match = /\S+/)
|
162
164
|
@filename = filename
|
data/text-data-tools.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text-data-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
segments:
|
113
113
|
- 0
|
114
|
-
hash: -
|
114
|
+
hash: -2216339992991240693
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|