Class: Pajamas::ExperimentBadgeComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/pajamas/experiment_badge_component.rb

Constant Summary collapse

TYPE_OPTIONS =
[:experiment, :beta].freeze
POPOVER_PLACEMENT_OPTIONS =
%w[top bottom left right].freeze

Instance Method Summary collapse

Constructor Details

#initialize(type: :experiment, popover_placement: 'bottom') ⇒ ExperimentBadgeComponent

Returns a new instance of ExperimentBadgeComponent.

Parameters:

  • type (Symbol) (defaults to: :experiment)

    The type of badge (:experiment or :beta)

  • popover_placement (String) (defaults to: 'bottom')

    The placement of the popover (top, bottom, left, right)



10
11
12
13
# File 'app/components/pajamas/experiment_badge_component.rb', line 10

def initialize(type: :experiment, popover_placement: 'bottom')
  @type = filter_attribute(type.to_sym, TYPE_OPTIONS, default: :experiment)
  @popover_placement = filter_attribute(popover_placement.to_s, POPOVER_PLACEMENT_OPTIONS, default: 'bottom')
end