Sha256: f71a41535e5b3ac3a3c14f12517ab68a6f154170334adcf0932b0ce1dd3ebea1

Contents?: true

Size: 476 Bytes

Versions: 85

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

class Avo::CardComponent < ViewComponent::Base
  attr_reader :card

  def initialize(card: nil)
    @card = card

    init_card
  end

  def render?
    card.present?
  end

  # Initializing the card byt running the query method.
  # We'll still keep the query block around for compatibility reasons.
  def init_card
    if card.respond_to? :query
      card.query
    elsif card.query_block.present?
      card.compute_result
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
avo-2.21.0 app/components/avo/card_component.rb
avo-2.21.1.pre.pr1476 app/components/avo/card_component.rb
avo-2.21.1.pre.issue1450 app/components/avo/card_component.rb
avo-2.21.1.pre.issue1444 app/components/avo/card_component.rb
avo-2.20.0 app/components/avo/card_component.rb