Class: Portable::Rendering::Row
- Inherits:
-
Object
- Object
- Portable::Rendering::Row
- Defined in:
- lib/portable/rendering/row.rb
Overview
Internal intermediary class that knows how to combine columns specification instances with their respective Realize pipelines.
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
:nodoc: all.
-
#resolver ⇒ Object
readonly
:nodoc: all.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(columns, resolver: Objectable.resolver) ⇒ Row
constructor
A new instance of Row.
- #merge(other) ⇒ Object
- #model_columns ⇒ Object
- #render(object, time) ⇒ Object
Constructor Details
#initialize(columns, resolver: Objectable.resolver) ⇒ Row
Returns a new instance of Row.
19 20 21 22 23 24 |
# File 'lib/portable/rendering/row.rb', line 19 def initialize(columns, resolver: Objectable.resolver) @resolver = resolver @columns = columns.map { |column| Column.new(column, resolver: resolver) } freeze end |
Instance Attribute Details
#columns ⇒ Object (readonly)
:nodoc: all
17 18 19 |
# File 'lib/portable/rendering/row.rb', line 17 def columns @columns end |
#resolver ⇒ Object (readonly)
:nodoc: all
17 18 19 |
# File 'lib/portable/rendering/row.rb', line 17 def resolver @resolver end |
Instance Method Details
#headers ⇒ Object
30 31 32 |
# File 'lib/portable/rendering/row.rb', line 30 def headers columns.map(&:header) end |
#merge(other) ⇒ Object
38 39 40 |
# File 'lib/portable/rendering/row.rb', line 38 def merge(other) self.class.new(model_columns + other.model_columns, resolver: resolver) end |
#model_columns ⇒ Object
34 35 36 |
# File 'lib/portable/rendering/row.rb', line 34 def model_columns columns.map(&:column) end |
#render(object, time) ⇒ Object
26 27 28 |
# File 'lib/portable/rendering/row.rb', line 26 def render(object, time) columns.map { |column| column.transform(object, time) } end |