Module: Marquery::Collection

Included in:
Index
Defined in:
lib/marquery/collection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



13
14
15
# File 'lib/marquery/collection.rb', line 13

def content
  @content
end

#descriptionObject (readonly)

Returns the value of attribute description.



13
14
15
# File 'lib/marquery/collection.rb', line 13

def description
  @description
end

#titleObject (readonly)

Returns the value of attribute title.



13
14
15
# File 'lib/marquery/collection.rb', line 13

def title
  @title
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
# File 'lib/marquery/collection.rb', line 8

def self.included(base)
  base.include(Marquery::Renderable)
  base.include(Marquery::Attributable)
end

Instance Method Details

#initialize(attrs = {}) ⇒ Object



15
16
17
18
19
# File 'lib/marquery/collection.rb', line 15

def initialize(attrs = {})
  attrs = attrs.transform_keys(&:to_sym)
  assign_standard_attributes(attrs)
  assign_declared_attributes(attrs)
end

#to_hObject



21
22
23
24
25
26
27
# File 'lib/marquery/collection.rb', line 21

def to_h
  {title:, description:, content:, assets:}.tap do |base|
    self.class.attributes.each_key do |name|
      base[name] = public_send(name)
    end
  end
end