Sha256: ca054882c7d27e1f2be335d9eba8c36a2924f944fa1653af49c89af20116ce01
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module Spread2RDF module Mapping class Spreadsheet < Element attr_reader :input_file def initialize(schema, filename) super(schema, nil) @worksheets = {} @input_file = filename ROO.load(filename) end def map schema.sorted_worksheets.each do |worksheet_schema| worksheet!(worksheet_schema) end self end def worksheet_schema(name) case name when Schema::Worksheet then name when String, Symbol then schema.worksheet[name] else raise ArgumentError end end ########################################################################## # Mapping::Element structure def spreadsheet self end def worksheets @worksheets.values end alias _children_ worksheets def worksheet(name) @worksheets[worksheet_schema(name).name] end def worksheet!(name) worksheet_schema = worksheet_schema(name) @worksheets[worksheet_schema.name] || begin @worksheets[worksheet_schema.name] = mapping = Mapping::Worksheet.new(worksheet_schema, self) mapping.map end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spread2rdf-0.0.1 | lib/spread2rdf/mapping/spreadsheet.rb |