Class: Locomotive::Wagon::SectionDecorator

Inherits:
Steam::Decorators::TemplateDecorator
  • Object
show all
Includes:
PersistAssetsConcern, ToHashConcern
Defined in:
lib/locomotive/wagon/decorators/section_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PersistAssetsConcern

#asset_io, #replace_with_content_assets!, #replace_with_content_assets_in_hash!

Methods included from ToHashConcern

#prepare_value_for_hash, #to_hash

Constructor Details

#initialize(object, content_assets_pusher) ⇒ SectionDecorator

Returns a new instance of SectionDecorator.



11
12
13
14
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 11

def initialize(object, content_assets_pusher)
  self.__content_assets_pusher__ = content_assets_pusher
  super(object, nil, nil)
end

Instance Attribute Details

#__content_assets_pusher__Object

Returns the value of attribute content_assets_pusher.



9
10
11
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 9

def __content_assets_pusher__
  @__content_assets_pusher__
end

Instance Method Details

#__attributes__Object



16
17
18
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 16

def __attributes__
  %i(name slug template definition)
end

#definitionObject



28
29
30
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 28

def definition
  replace_with_content_assets!(__getobj__.definition.to_json)
end

#idObject



20
21
22
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 20

def id
  slug
end

#templateObject



24
25
26
# File 'lib/locomotive/wagon/decorators/section_decorator.rb', line 24

def template
  replace_with_content_assets!(self.liquid_source)
end