Class: HakumiComponents::Progress::InfoTooltipPolicy
- Inherits:
-
Object
- Object
- HakumiComponents::Progress::InfoTooltipPolicy
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/progress/info_tooltip_policy.rb
Constant Summary collapse
- TooltipMode =
T.type_alias { T.nilable(Symbol) }
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#initialize(mode:, type:, circle_size:, threshold:) ⇒ InfoTooltipPolicy
constructor
A new instance of InfoTooltipPolicy.
- #wrap? ⇒ Boolean
Constructor Details
#initialize(mode:, type:, circle_size:, threshold:) ⇒ InfoTooltipPolicy
Returns a new instance of InfoTooltipPolicy.
12 13 14 15 16 17 |
# File 'app/components/hakumi_components/progress/info_tooltip_policy.rb', line 12 def initialize(mode:, type:, circle_size:, threshold:) @mode = T.let(mode, TooltipMode) @type = T.let(type, Symbol) @circle_size = T.let(circle_size, Integer) @threshold = T.let(threshold, Integer) end |
Instance Method Details
#enabled? ⇒ Boolean
20 21 22 |
# File 'app/components/hakumi_components/progress/info_tooltip_policy.rb', line 20 def enabled? !@mode.nil? end |
#wrap? ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/components/hakumi_components/progress/info_tooltip_policy.rb', line 25 def wrap? return false unless enabled? case @mode when :always true when :auto @type == :circle && @circle_size <= @threshold else false end end |