Class: SheetWrap::Worksheet
- Inherits:
-
Object
- Object
- SheetWrap::Worksheet
- Extended by:
- Forwardable
- Defined in:
- lib/sheet_wrap/worksheet.rb
Instance Attribute Summary collapse
-
#drive_worksheet ⇒ Object
readonly
Returns the value of attribute drive_worksheet.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(drive_worksheet) ⇒ Worksheet
constructor
A new instance of Worksheet.
- #load ⇒ Object
- #reload ⇒ Object
Constructor Details
#initialize(drive_worksheet) ⇒ Worksheet
Returns a new instance of Worksheet.
15 16 17 18 |
# File 'lib/sheet_wrap/worksheet.rb', line 15 def initialize(drive_worksheet) @drive_worksheet = drive_worksheet load end |
Instance Attribute Details
#drive_worksheet ⇒ Object (readonly)
Returns the value of attribute drive_worksheet.
5 6 7 |
# File 'lib/sheet_wrap/worksheet.rb', line 5 def drive_worksheet @drive_worksheet end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/sheet_wrap/worksheet.rb', line 5 def headers @headers end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
5 6 7 |
# File 'lib/sheet_wrap/worksheet.rb', line 5 def rows @rows end |
Instance Method Details
#load ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/sheet_wrap/worksheet.rb', line 20 def load @headers = (1..num_cols).map{|col| drive_worksheet[1, col] } @rows = (2..num_rows).map do |row| ::SheetWrap::Row.new(self, row) end end |
#reload ⇒ Object
28 29 30 31 |
# File 'lib/sheet_wrap/worksheet.rb', line 28 def reload @drive_worksheet.reload load end |