Class: Rrxcell::Book
- Inherits:
-
Object
show all
- Defined in:
- lib/rrxcell/book.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path) ⇒ Book
Returns a new instance of Book.
4
5
6
7
|
# File 'lib/rrxcell/book.rb', line 4
def initialize(path)
super()
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
2
3
4
|
# File 'lib/rrxcell/book.rb', line 2
def path
@path
end
|
Instance Method Details
#[](position_or_sheet_name) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/rrxcell/book.rb', line 9
def [](position_or_sheet_name)
case position_or_sheet_name
when Numeric
sheet(position_or_sheet_name)
when String
sheet(sheet_position_by_name!(position_or_sheet_name))
else
raise "invalid sheet position"
end
end
|
#address(cell_address) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/rrxcell/book.rb', line 20
def address(cell_address)
sheet_position, row_position, column_position =
Rrxcell::Addressing.cell_address_to_sheet_row_column_position(cell_address, self)
sheet(sheet_position).row(row_position).column(column_position)
end
|
#sheet(position) ⇒ Object
27
28
29
|
# File 'lib/rrxcell/book.rb', line 27
def sheet(position)
raise ShouldBeImplementedError
end
|
#sheet_names ⇒ Object
35
36
37
|
# File 'lib/rrxcell/book.rb', line 35
def sheet_names
object.sheets
end
|
#sheets ⇒ Object
31
32
33
|
# File 'lib/rrxcell/book.rb', line 31
def sheets
sheet_names.map { |s| sheet(sheet_names.index(s)) }
end
|