Class: DaisyUI::RadialProgress

Inherits:
Base
  • Object
show all
Defined in:
lib/daisy_ui/radial_progress.rb

Constant Summary

Constants inherited from Base

Base::BOOLS, Base::COLOR_MODIFIERS

Instance Method Summary collapse

Methods inherited from Base

inherited, register_modifiers

Constructor Details

#initialize(value:, as: :div, size: nil, thickness: nil) ⇒ RadialProgress

Returns a new instance of RadialProgress.



7
8
9
10
11
12
# File 'lib/daisy_ui/radial_progress.rb', line 7

def initialize(*, value:, as: :div, size: nil, thickness: nil, **)
  super(*, as:, **)
  @value = value
  @size = size
  @thickness = thickness
end

Instance Method Details

#view_templateObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/daisy_ui/radial_progress.rb', line 14

def view_template(&)
  style = options.delete(:style)

  # Build style string
  style_parts = []
  style_parts << style if style && !style.empty?
  style_parts << "--value: #{value};"
  style_parts << "--size: #{size};" if size && !size.to_s.empty?
  style_parts << "--thickness: #{thickness};" if thickness && !thickness.to_s.empty?

  public_send(as, role: :progressbar, class: classes, style: style_parts.join(" "), **attributes, &)
end