Class: Mensa::Cell
- Inherits:
-
Object
- Object
- Mensa::Cell
- Includes:
- ActionView::Helpers::SanitizeHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper, ApplicationHelper
- Defined in:
- app/tables/mensa/cell.rb,
app/components/mensa/cell/component.rb
Defined Under Namespace
Classes: Component
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
Instance Method Summary collapse
-
#initialize(row:, column:) ⇒ Cell
constructor
A new instance of Cell.
- #render(format) ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(row:, column:) ⇒ Cell
Returns a new instance of Cell.
13 14 15 16 |
# File 'app/tables/mensa/cell.rb', line 13 def initialize(row:, column:) @row = row @column = column end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
11 12 13 |
# File 'app/tables/mensa/cell.rb', line 11 def column @column end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
11 12 13 |
# File 'app/tables/mensa/cell.rb', line 11 def row @row end |
Instance Method Details
#render(format) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/tables/mensa/cell.rb', line 22 def render(format) proc = column.config.dig(:render, format.to_sym) if proc row.table.original_view_context.instance_exec(row.record, &proc) else send("to_#{format}".to_sym) end end |
#value ⇒ Object
18 19 20 |
# File 'app/tables/mensa/cell.rb', line 18 def value @value ||= row.value(column) end |