Class: Timely::Cell
- Inherits:
-
Object
- Object
- Timely::Cell
- Defined in:
- lib/timely/cell.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#report ⇒ Object
Returns the value of attribute report.
-
#row ⇒ Object
Returns the value of attribute row.
Instance Method Summary collapse
- #cache_key ⇒ Object
- #cacheable? ⇒ Boolean
- #column_key ⇒ Object
- #column_title ⇒ Object
-
#initialize(report, column, row) ⇒ Cell
constructor
A new instance of Cell.
- #row_title ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(report, column, row) ⇒ Cell
Returns a new instance of Cell.
7 8 9 10 11 |
# File 'lib/timely/cell.rb', line 7 def initialize(report, column, row) self.report = report self.column = column self.row = row end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
5 6 7 |
# File 'lib/timely/cell.rb', line 5 def column @column end |
#report ⇒ Object
Returns the value of attribute report.
5 6 7 |
# File 'lib/timely/cell.rb', line 5 def report @report end |
#row ⇒ Object
Returns the value of attribute row.
5 6 7 |
# File 'lib/timely/cell.rb', line 5 def row @row end |
Instance Method Details
#cache_key ⇒ Object
37 38 39 |
# File 'lib/timely/cell.rb', line 37 def cache_key @cache_key ||= [report.cache_key, row.cache_key, column.cache_key].join(cache_sep) end |
#cacheable? ⇒ Boolean
33 34 35 |
# File 'lib/timely/cell.rb', line 33 def cacheable? row.cacheable? && column.cacheable? end |
#column_key ⇒ Object
17 18 19 |
# File 'lib/timely/cell.rb', line 17 def column_key column.to_i end |
#column_title ⇒ Object
21 22 23 |
# File 'lib/timely/cell.rb', line 21 def column_title column.title end |
#row_title ⇒ Object
25 26 27 |
# File 'lib/timely/cell.rb', line 25 def row_title row.title end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/timely/cell.rb', line 13 def to_s "#<#{self.class.name} row: \"#{row.title}\", starts_at: #{column.starts_at}, ends_at: #{column.ends_at}>" end |
#value ⇒ Object
29 30 31 |
# File 'lib/timely/cell.rb', line 29 def value @value ||= cacheable? ? value_with_caching : value_without_caching end |