Class: BulmaPhlex::ProgressBar
- Defined in:
- lib/bulma_phlex/progress_bar.rb
Overview
Renders the [Bulma progress bar element](bulma.io/documentation/elements/progress/).
Supports color and size options. Omitting ‘value` and `max` from the HTML attributes produces an indeterminate (animated) progress bar.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(color: nil, size: nil, **html_attributes) ⇒ ProgressBar
constructor
A new instance of ProgressBar.
- #view_template ⇒ Object
Constructor Details
#initialize(color: nil, size: nil, **html_attributes) ⇒ ProgressBar
Returns a new instance of ProgressBar.
19 20 21 22 23 |
# File 'lib/bulma_phlex/progress_bar.rb', line 19 def initialize(color: nil, size: nil, **html_attributes) @color = color @size = size @html_attributes = html_attributes end |
Class Method Details
.new(color: nil, size: nil, **html_attributes) ⇒ Object
Parameters
-
‘color` — [Color of the progress bar](bulma.io/documentation/elements/progress/#colors)
-
‘size` — [Size of the progress bar](bulma.io/documentation/elements/progress/#sizes): `“small”`,
‘“normal”`, `“medium”`, `“large”`
-
‘**html_attributes` — Additional HTML attributes for the progress element; use `value` and `max` to set progress
15 16 17 |
# File 'lib/bulma_phlex/progress_bar.rb', line 15 def self.new(color: nil, size: nil, **html_attributes) super end |
Instance Method Details
#view_template ⇒ Object
25 26 27 |
# File 'lib/bulma_phlex/progress_bar.rb', line 25 def view_template(&) progress(**mix({ class: classes }, @html_attributes), &) end |