Class: Primer::ProgressBarComponent::Item

Inherits:
ViewComponent::Slot
  • Object
show all
Includes:
ClassNameHelper
Defined in:
app/components/primer/progress_bar_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(percentage: 0, bg: :green, **system_arguments) ⇒ Item



65
66
67
68
69
70
71
72
73
# File 'app/components/primer/progress_bar_component.rb', line 65

def initialize(percentage: 0, bg: :green, **system_arguments)
  @percentage = percentage
  @system_arguments = system_arguments

  @system_arguments[:tag] = :span
  @system_arguments[:bg] = bg
  @system_arguments[:style] = "width: #{@percentage}%;"
  @system_arguments[:classes] = class_names("Progress-item", @system_arguments[:classes])
end

Instance Attribute Details

#system_argumentsObject (readonly)

Returns the value of attribute system_arguments.



60
61
62
# File 'app/components/primer/progress_bar_component.rb', line 60

def system_arguments
  @system_arguments
end