Class: Maglev::TagHelper::WrapperTagBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/components/maglev/tag_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context, component) ⇒ WrapperTagBuilder

Returns a new instance of WrapperTagBuilder.



26
27
28
29
# File 'app/components/maglev/tag_helper.rb', line 26

def initialize(view_context, component)
  @view_context = view_context
  @component = component
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, options = nil, &block) ⇒ Object



31
32
33
34
35
36
# File 'app/components/maglev/tag_helper.rb', line 31

def method_missing(name, options = nil, &block)
  component.wrapper_tag(
    (options || {}).merge(html_tag: name),
    &block
  )
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



24
25
26
# File 'app/components/maglev/tag_helper.rb', line 24

def component
  @component
end

#view_contextObject (readonly)

Returns the value of attribute view_context.



24
25
26
# File 'app/components/maglev/tag_helper.rb', line 24

def view_context
  @view_context
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/components/maglev/tag_helper.rb', line 38

def respond_to_missing?
  true
end