Module: Stimul8::Component

Extended by:
ActiveSupport::Concern
Defined in:
lib/stimul8/component.rb,
lib/stimul8/component/core.rb,
lib/stimul8/component/create.rb,
lib/stimul8/component/models.rb,
lib/stimul8/component/actions.rb,
lib/stimul8/component/storage.rb

Defined Under Namespace

Modules: Actions, Core, Create, Models, Storage Classes: NotFound

Class Method Summary collapse

Class Method Details

.component(component_class, properties = {}, &contents) ⇒ Object Also known as: c



23
24
25
26
27
# File 'lib/stimul8/component.rb', line 23

def component(component_class, properties = {}, &contents)
  component_class = "#{component_class.to_s.classify}Component"
  component = component_class.constantize.new(**properties, &contents)
  component.to_html.html_safe
end

.recreate(component_class, component_id, context: nil) ⇒ Object



19
20
21
# File 'lib/stimul8/component.rb', line 19

def recreate component_class, component_id, context: nil
  component_class.constantize.new(component_id: component_id, context: context)
end