module ActionComponent::Elements
Constants
- ELEMENTS
Public Instance Methods
Private Instance Methods
doctype(text = "html")
click to toggle source
# File lib/action_component/elements.rb, line 40 def doctype(text = "html") @_view.concat("<!doctype #{h(text)}>".html_safe) end
e()
click to toggle source
# File lib/action_component/elements.rb, line 70 def e ElementBuilder.new(self) end
element(name, first = nil, second = nil, &block)
click to toggle source
# File lib/action_component/elements.rb, line 44 def element(name, first = nil, second = nil, &block) if first.is_a?(Hash) opts = first elsif second.is_a?(String) || second.is_a?(Symbol) opts = {class: second.to_s} text = first else opts = second text = first end output = if text && block raise ActionComponent::RenderError, "An element cannot have both text and a block supplied; choose one or the other" elsif text @_view.content_tag name, text, opts elsif block @_view.content_tag name, opts, &block else @_view.tag name, opts end @_view.concat(output) nil end