Module: Spark::Component::Integration::ClassMethods

Defined in:
lib/spark/component/integration/action_view_component.rb

Overview

Override class methods for components

Instance Method Summary collapse

Instance Method Details

#inherit_templateObject

Override source_location to allow a component to uses the superclass’s template



47
48
49
# File 'lib/spark/component/integration/action_view_component.rb', line 47

def inherit_template
  define_singleton_method(:source_location) { superclass.source_location }
end

#use_template(klass) ⇒ Object

Use a template from a specific class



52
53
54
# File 'lib/spark/component/integration/action_view_component.rb', line 52

def use_template(klass)
  define_singleton_method(:source_location) { klass.source_location }
end