Class: SimpleXlsxReader::Document
- Inherits:
-
Object
- Object
- SimpleXlsxReader::Document
- Defined in:
- lib/simple_xlsx_reader.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Document
constructor
A new instance of Document.
- #sheets ⇒ Object
- #to_hash ⇒ Object
- #xml ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Document
Returns a new instance of Document.
35 36 37 |
# File 'lib/simple_xlsx_reader.rb', line 35 def initialize(file_path) @file_path = file_path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
33 34 35 |
# File 'lib/simple_xlsx_reader.rb', line 33 def file_path @file_path end |
Instance Method Details
#sheets ⇒ Object
39 40 41 |
# File 'lib/simple_xlsx_reader.rb', line 39 def sheets @sheets ||= Mapper.new(xml).load_sheets end |
#to_hash ⇒ Object
43 44 45 |
# File 'lib/simple_xlsx_reader.rb', line 43 def to_hash sheets.inject({}) {|acc, sheet| acc[sheet.name] = sheet.rows; acc} end |