Module: Interfacets::Shared::Facet

Extended by:
ActiveSupport::Concern
Defined in:
lib/interfacets/shared/facet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Instance Attribute Details

#entity ⇒ Object (readonly)

Returns the value of attribute entity.



189
190
191
# File 'lib/interfacets/shared/facet.rb', line 189

def entity
  @entity
end

#view ⇒ Object (readonly)

Returns the value of attribute view.



189
190
191
# File 'lib/interfacets/shared/facet.rb', line 189

def view
  @view
end

Instance Method Details

#initialize(entity) ⇒ Object



190
191
192
193
# File 'lib/interfacets/shared/facet.rb', line 190

def initialize(entity)
  @entity = entity
  @view = self.class.view.new if self.class.view.is_a?(Class)
end

#render(channels) ⇒ Object



195
196
197
# File 'lib/interfacets/shared/facet.rb', line 195

def render(channels)
  view.render(entity:, channels:)
end