Class: Avo::CardComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Avo::CardComponent
- Defined in:
- app/components/avo/card_component.rb
Instance Attribute Summary collapse
-
#card ⇒ Object
readonly
Returns the value of attribute card.
Instance Method Summary collapse
-
#init_card ⇒ Object
Initializing the card byt running the query method.
-
#initialize(card: nil) ⇒ CardComponent
constructor
A new instance of CardComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(card: nil) ⇒ CardComponent
Returns a new instance of CardComponent.
6 7 8 9 10 |
# File 'app/components/avo/card_component.rb', line 6 def initialize(card: nil) @card = card init_card end |
Instance Attribute Details
#card ⇒ Object (readonly)
Returns the value of attribute card.
4 5 6 |
# File 'app/components/avo/card_component.rb', line 4 def card @card end |
Instance Method Details
#init_card ⇒ Object
Initializing the card byt running the query method. We’ll still keep the query block around for compatibility reasons.
18 19 20 21 22 23 24 |
# File 'app/components/avo/card_component.rb', line 18 def init_card if card.respond_to? :query card.query elsif card.query_block.present? card.compute_result end end |
#render? ⇒ Boolean
12 13 14 |
# File 'app/components/avo/card_component.rb', line 12 def render? card.present? end |