Module: Clearwater::Component

Extended by:
Component
Included in:
Component, Link
Defined in:
lib/clearwater/component.rb

Defined Under Namespace

Classes: Tag

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#outletObject

Returns the value of attribute outlet.



9
10
11
# File 'lib/clearwater/component.rb', line 9

def outlet
  @outlet
end

#routerObject

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

#paramsObject



35
36
37
# File 'lib/clearwater/component.rb', line 35

def params
  router.params_for_path(router.current_path)
end

#renderObject



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_sObject



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