Class: Nquery::CardComponent
- Defined in:
- app/components/nquery/card_component.rb
Instance Attribute Summary collapse
-
#html_class ⇒ Object
readonly
Returns the value of attribute html_class.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #css_class ⇒ Object
-
#initialize(title: nil, class: nil) ⇒ CardComponent
constructor
A new instance of CardComponent.
Methods inherited from Component
Constructor Details
#initialize(title: nil, class: nil) ⇒ CardComponent
Returns a new instance of CardComponent.
7 8 9 10 |
# File 'app/components/nquery/card_component.rb', line 7 def initialize(title: nil, class: nil) @title = title @html_class = binding.local_variable_get(:class) end |
Instance Attribute Details
#html_class ⇒ Object (readonly)
Returns the value of attribute html_class.
5 6 7 |
# File 'app/components/nquery/card_component.rb', line 5 def html_class @html_class end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'app/components/nquery/card_component.rb', line 5 def title @title end |
Instance Method Details
#css_class ⇒ Object
12 13 14 15 16 |
# File 'app/components/nquery/card_component.rb', line 12 def css_class classes = ["nq-card"] classes << html_class if html_class.present? classes.join(" ") end |