lib/excelfile/workbook.rb in rubyfromexcel-0.0.18 vs lib/excelfile/workbook.rb in rubyfromexcel-0.0.19
- old
+ new
@@ -40,11 +40,11 @@
end
end
def work_out_named_references_from(xml)
xml.css('definedName').each do |defined_name_xml|
- reference_name = defined_name_xml['name'].gsub(/([a-z])([A-Z])/,'\1_\2').downcase.gsub(/[^a-z0-9_]/,'_')
+ reference_name = defined_name_xml['name'].downcase # .gsub(/[^a-z0-9_]/,'_')
reference_value = defined_name_xml.content
if reference_value.start_with?('[')
puts "Sorry, #{reference_name} (#{reference_value}) has a link to an external workbook. Skipping."
next
end
@@ -95,10 +95,10 @@
r.put_method "initialize" do
r.puts "@worksheet_names = #{Hash[SheetNames.instance.sort]}"
r.puts "@workbook_tables = #{Hash[Table.tables.sort]}"
end
named_references.each do |name,reference|
- r.put_simple_method name, reference
+ r.put_simple_method name.downcase.gsub(/[^\p{word}]/,'_'), reference
end
end
end
r.puts 'Dir[File.join(File.dirname(__FILE__),"sheets/","sheet*.rb")].each {|f| Spreadsheet.autoload(File.basename(f,".rb").capitalize,f)}'
r.to_s
\ No newline at end of file