Module: Ilex::Component
- Includes:
- Arbre::HTML
- Defined in:
- lib/ilex/component.rb
Overview
InlineRender provides a ‘render` dsl to your components which will render any arbre tree within.
It will also convert snake case component names to component instances for example, this would be equivalent to ‘ButtonComponent.new(label: “Test”)`
“‘ruby render do
div do
label: "Test"
end
end “‘
Instance Method Summary collapse
Instance Method Details
#find_component(name, base_module = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ilex/component.rb', line 29 def find_component(name, base_module = nil) target = if base_module base_module else self end if target.const_defined?(name) target.const_get(name) else if target.superclass.respond_to?(:find_component) target.superclass.find_component(name) else adjusted_name = name.chomp("Component").underscore raise(NameError, "undefined local variable or method `#{adjusted_name}` for #{self}") end end end |