Class: Lite::Component::Collection
- Inherits:
-
Object
- Object
- Lite::Component::Collection
- Defined in:
- lib/lite/component/collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#spacer_template ⇒ Object
readonly
Returns the value of attribute spacer_template.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(collection, component:, spacer_template: nil) ⇒ Collection
constructor
A new instance of Collection.
- #render ⇒ Object
Constructor Details
#initialize(collection, component:, spacer_template: nil) ⇒ Collection
Returns a new instance of Collection.
9 10 11 12 13 |
# File 'lib/lite/component/collection.rb', line 9 def initialize(collection, component:, spacer_template: nil) @collection = collection @component = component @spacer_template = spacer_template end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
7 8 9 |
# File 'lib/lite/component/collection.rb', line 7 def collection @collection end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
7 8 9 |
# File 'lib/lite/component/collection.rb', line 7 def component @component end |
#spacer_template ⇒ Object (readonly)
Returns the value of attribute spacer_template.
7 8 9 |
# File 'lib/lite/component/collection.rb', line 7 def spacer_template @spacer_template end |
Class Method Details
.render(collection, component) ⇒ Object
17 18 19 20 |
# File 'lib/lite/component/collection.rb', line 17 def render(collection, component) klass = new(collection, component) klass.render end |
Instance Method Details
#render ⇒ Object
24 25 26 |
# File 'lib/lite/component/collection.rb', line 24 def render component.context.safe_join(iterated_collection) end |