hyogen 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -1
- data/Rakefile +1 -3
- data/lib/hyogen/reader.rb +6 -4
- data/lib/hyogen/version.rb +1 -1
- data/spec/spec_hyogen.rb +8 -0
- metadata +2 -2
data/README
CHANGED
data/Rakefile
CHANGED
@@ -45,7 +45,6 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
45
45
|
p.url = HOMEPATH
|
46
46
|
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
47
|
# p.test_globs = ["test/**/test_*.rb"]
|
48
|
-
# p.test_globs = ["spec/**/spec_*.rb", "spec/**/*.csv", "spec/**/*.xls"]
|
49
48
|
p.test_globs = ["spec/**/*[^~]"]
|
50
49
|
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
51
50
|
# p.package_files.include("spec/**/*")
|
@@ -104,8 +103,7 @@ Rake::RDocTask.new do |rdoc|
|
|
104
103
|
if ENV['DOC_FILES']
|
105
104
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
106
105
|
else
|
107
|
-
|
108
|
-
rdoc.rdoc_files.include('README')
|
106
|
+
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
109
107
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
110
108
|
end
|
111
109
|
end
|
data/lib/hyogen/reader.rb
CHANGED
@@ -159,12 +159,13 @@ module Hyogen
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def add_label label_names, label_start_position
|
162
|
-
@previous_label_name =
|
162
|
+
@previous_label_name = ""
|
163
163
|
label_names.each_with_index do |label_name, i|
|
164
|
-
|
164
|
+
label_name ||= ""
|
165
|
+
if label_name != ""
|
165
166
|
label_name = Tag.aliased(label_name)
|
166
167
|
else
|
167
|
-
raise "���x����������܂���" unless @previous_label_name
|
168
|
+
# raise "���x����������܂���" unless @previous_label_name
|
168
169
|
label_name = @previous_label_name
|
169
170
|
end
|
170
171
|
@scheme.add_label label_name, label_start_position+i
|
@@ -245,7 +246,8 @@ module Hyogen
|
|
245
246
|
def self.worksheet_to_matrix worksheet
|
246
247
|
data = []
|
247
248
|
worksheet.num_rows.times do |r|
|
248
|
-
data << worksheet.row(r).collect {|cell| cell.to_s(CHAR_CODE)}
|
249
|
+
# data << worksheet.row(r).collect {|cell| cell.to_s(CHAR_CODE)}
|
250
|
+
data << worksheet.row(r).collect {|cell| cell.to_s == "" ? "" : cell.to_s(CHAR_CODE).to_s}
|
249
251
|
end
|
250
252
|
Matrix.new(data)
|
251
253
|
end
|
data/lib/hyogen/version.rb
CHANGED
data/spec/spec_hyogen.rb
CHANGED
@@ -231,6 +231,14 @@ context "label syoryaku" do
|
|
231
231
|
table = Hyogen.parse_tables(csvdata).first
|
232
232
|
table.records.should == expect
|
233
233
|
end
|
234
|
+
specify "htable" do
|
235
|
+
csvdata = CSV.parse("{HTABLE},,\n{L},{L},leaf\nparent,child1,1\n,child2,2")
|
236
|
+
expect = [{"" => {"" => "leaf"}, "parent"=> {"child1" => "1", "child2" => "2"}}]
|
237
|
+
table = Hyogen.parse_tables(csvdata).first
|
238
|
+
# p table.labels
|
239
|
+
# exit
|
240
|
+
table.records.should == expect
|
241
|
+
end
|
234
242
|
|
235
243
|
specify "overwrite" do
|
236
244
|
csvdata = CSV.parse("{VTABLE},\n{L}a,\n{L}t,\n1,2")
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: hyogen
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2007-05-16 00:00:00 +09:00
|
8
8
|
summary: This package allows you to mapping CSV or Excel to Ruby objects and generating some data.
|
9
9
|
require_paths:
|
10
10
|
- lib
|