Class: Katalyst::Tables::Data
- Inherits:
-
Object
- Object
- Katalyst::Tables::Data
- Defined in:
- app/components/katalyst/tables/data.rb
Instance Method Summary collapse
- #call ⇒ Object (also: #to_s)
-
#initialize(record:, column:) ⇒ Data
constructor
A new instance of Data.
- #inspect ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(record:, column:) ⇒ Data
Returns a new instance of Data.
6 7 8 9 |
# File 'app/components/katalyst/tables/data.rb', line 6 def initialize(record:, column:) @record = record @column = column end |
Instance Method Details
#call ⇒ Object Also known as: to_s
17 18 19 20 21 |
# File 'app/components/katalyst/tables/data.rb', line 17 def call ActionView::OutputBuffer.new.tap do |output| output << value.to_s end.to_s end |
#inspect ⇒ Object
25 26 27 |
# File 'app/components/katalyst/tables/data.rb', line 25 def inspect "#<#{self.class.name} column: #{@column.inspect}, value: #{value.inspect}>" end |
#value ⇒ Object
11 12 13 14 15 |
# File 'app/components/katalyst/tables/data.rb', line 11 def value return @value if defined?(@value) @value = @record&.public_send(@column) end |