Class: Kanso::IconComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Kanso::IconComponent
- Defined in:
- app/components/kanso/icon_component.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name:, **options) ⇒ IconComponent
constructor
A new instance of IconComponent.
Constructor Details
#initialize(name:, **options) ⇒ IconComponent
Returns a new instance of IconComponent.
7 8 9 10 |
# File 'app/components/kanso/icon_component.rb', line 7 def initialize(name:, **) @name = name @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'app/components/kanso/icon_component.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'app/components/kanso/icon_component.rb', line 5 def @options end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/components/kanso/icon_component.rb', line 12 def call attributes = tag.attributes( .deep_merge(data: { icon_name: name }) ) raw_svg = cached_svg_content raw_svg.sub("<svg", "<svg #{attributes}").html_safe end |