hyogen 0.0.2 → 0.0.3

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/README CHANGED
@@ -43,5 +43,6 @@ Template format is erb.
43
43
  <b><></b>:: This tag means
44
44
 
45
45
  = Install
46
- require ParseExcel
46
+ require ParseExcel (version >= 2007-02-07) [http://scm.ywesee.com/?p=parseexcel]
47
47
 
48
+ gem install hyogen
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
- # rdoc.rdoc_files.include('README', 'CHANGELOG')
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
@@ -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 = nil
162
+ @previous_label_name = ""
163
163
  label_names.each_with_index do |label_name, i|
164
- if label_name
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
@@ -2,7 +2,7 @@ module Hyogen #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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.2
7
- date: 2007-05-14 00:00:00 +09:00
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