Module: Clearwater::Component
Defined Under Namespace
Classes: Tag
Instance Attribute Summary collapse
-
#outlet ⇒ Object
Returns the value of attribute outlet.
-
#router ⇒ Object
Returns the value of attribute router.
Instance Method Summary collapse
- #call(&block) ⇒ Object
- #params ⇒ Object
- #render ⇒ Object
- #tag(tag_name, attributes = nil, content = nil) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#outlet ⇒ Object
Returns the value of attribute outlet.
9 10 11 |
# File 'lib/clearwater/component.rb', line 9 def outlet @outlet end |
#router ⇒ Object
Returns the value of attribute router.
10 11 12 |
# File 'lib/clearwater/component.rb', line 10 def router @router end |
Instance Method Details
#call(&block) ⇒ Object
39 40 |
# File 'lib/clearwater/component.rb', line 39 def call &block end |
#params ⇒ Object
35 36 37 |
# File 'lib/clearwater/component.rb', line 35 def params router.params_for_path(router.current_path) end |
#render ⇒ Object
12 13 |
# File 'lib/clearwater/component.rb', line 12 def render end |
#tag(tag_name, attributes = nil, content = nil) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/clearwater/component.rb', line 21 def tag tag_name, attributes=nil, content=nil unless attributes.nil? || attributes.is_a?(Hash) content = attributes attributes = nil end Tag.new(tag_name, attributes, content) end |
#to_s ⇒ Object
30 31 32 33 |
# File 'lib/clearwater/component.rb', line 30 def to_s html = Array(render).join html.respond_to?(:html_safe) ? html.html_safe : html end |