Class: TaoUi::Components::IconComponent

Inherits:
TaoOnRails::Components::Base
  • Object
show all
Defined in:
lib/tao_ui/components/icon_component.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, name, options = {}) ⇒ IconComponent

Returns a new instance of IconComponent.



9
10
11
12
# File 'lib/tao_ui/components/icon_component.rb', line 9

def initialize view, name, options = {}
  @name = name.to_s.dasherize
  super view, options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/tao_ui/components/icon_component.rb', line 7

def name
  @name
end

Class Method Details

.component_nameObject



18
19
20
# File 'lib/tao_ui/components/icon_component.rb', line 18

def self.component_name
  :icon
end

Instance Method Details

#renderObject



14
15
16
# File 'lib/tao_ui/components/icon_component.rb', line 14

def render
  view.(:svg, %Q(<use xlink:href="#icon-#{name}"/>).html_safe, options)
end