Class: Decisive::XLSHasher
- Inherits:
-
Struct
- Object
- Struct
- Decisive::XLSHasher
- Defined in:
- lib/decisive/xls_hasher.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path
4 5 6 |
# File 'lib/decisive/xls_hasher.rb', line 4 def path @path end |
Instance Method Details
#to_hash ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/decisive/xls_hasher.rb', line 5 def to_hash spreadsheet = RubyXL::Parser.parse(path) spreadsheet.worksheets.reduce({}) do |hash, worksheet| actual = [] worksheet.each do |row| cells = row.cells.map do |cell| if cell.formula "=" + cell.formula.expression else cell.value end end actual << cells end hash.merge worksheet.sheet_name => actual end end |