Class: Lite::Component::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/lite/component/collection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#collectionObject (readonly)

Returns the value of attribute collection.



7
8
9
# File 'lib/lite/component/collection.rb', line 7

def collection
  @collection
end

#componentObject (readonly)

Returns the value of attribute component.



7
8
9
# File 'lib/lite/component/collection.rb', line 7

def component
  @component
end

#spacer_templateObject (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

#renderObject



24
25
26
# File 'lib/lite/component/collection.rb', line 24

def render
  component.context.safe_join(iterated_collection)
end