Class: CodengageViewComponents::ItemComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- CodengageViewComponents::ItemComponent
- Defined in:
- app/components/codengage_view_components/item_component.rb
Instance Method Summary collapse
- #data_attributes ⇒ Object
- #delete? ⇒ Boolean
- #icon_size ⇒ Object
- #icon_stroke ⇒ Object
-
#initialize(value:, url:, method: :get, icon: nil, options: {}) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
- #text_class ⇒ Object
Constructor Details
#initialize(value:, url:, method: :get, icon: nil, options: {}) ⇒ ItemComponent
Returns a new instance of ItemComponent.
5 6 7 8 9 10 11 |
# File 'app/components/codengage_view_components/item_component.rb', line 5 def initialize(value:, url:, method: :get, icon: nil, options: {}) @value = value @url = url @method = method @icon = icon @options = end |
Instance Method Details
#data_attributes ⇒ Object
13 14 15 |
# File 'app/components/codengage_view_components/item_component.rb', line 13 def data_attributes @options.fetch(:data, {}) end |
#delete? ⇒ Boolean
29 30 31 |
# File 'app/components/codengage_view_components/item_component.rb', line 29 def delete? @method.to_s == "delete" end |
#icon_size ⇒ Object
25 26 27 |
# File 'app/components/codengage_view_components/item_component.rb', line 25 def icon_size @options.fetch(:icon_size, "") end |
#icon_stroke ⇒ Object
21 22 23 |
# File 'app/components/codengage_view_components/item_component.rb', line 21 def icon_stroke @options.fetch(:icon_stroke, "gray") end |
#text_class ⇒ Object
17 18 19 |
# File 'app/components/codengage_view_components/item_component.rb', line 17 def text_class @options.fetch(:text_class, "") end |