Class: TaoUi::Components::IconComponent
- Inherits:
-
TaoOnRails::Components::Base
- Object
- TaoOnRails::Components::Base
- TaoUi::Components::IconComponent
- Defined in:
- lib/tao_ui/components/icon_component.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, name, options = {}) ⇒ IconComponent
constructor
A new instance of IconComponent.
- #render ⇒ Object
Constructor Details
#initialize(view, name, options = {}) ⇒ IconComponent
Returns a new instance of IconComponent.
7 8 9 10 |
# File 'lib/tao_ui/components/icon_component.rb', line 7 def initialize view, name, = {} @name = name.to_s.dasherize super view, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/tao_ui/components/icon_component.rb', line 5 def name @name end |
Class Method Details
.component_name ⇒ Object
16 17 18 |
# File 'lib/tao_ui/components/icon_component.rb', line 16 def self.component_name :icon end |
Instance Method Details
#render ⇒ Object
12 13 14 |
# File 'lib/tao_ui/components/icon_component.rb', line 12 def render view.content_tag(:svg, %Q(<use xlink:href="#icon-#{name}"/>).html_safe, ) end |