Class: HakumiComponents::Carousel::AutoplayConfig

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
app/components/hakumi_components/carousel/autoplay_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled:, dot_duration: false) ⇒ AutoplayConfig

Returns a new instance of AutoplayConfig.



10
11
12
13
# File 'app/components/hakumi_components/carousel/autoplay_config.rb', line 10

def initialize(enabled:, dot_duration: false)
  @enabled = T.let(enabled, T::Boolean)
  @dot_duration = T.let(dot_duration, T::Boolean)
end

Instance Attribute Details

#dot_durationObject (readonly)

Returns the value of attribute dot_duration.



16
17
18
# File 'app/components/hakumi_components/carousel/autoplay_config.rb', line 16

def dot_duration
  @dot_duration
end

#enabledObject (readonly)

Returns the value of attribute enabled.



16
17
18
# File 'app/components/hakumi_components/carousel/autoplay_config.rb', line 16

def enabled
  @enabled
end

Class Method Details

.coerce(value) ⇒ Object



19
20
21
22
23
24
# File 'app/components/hakumi_components/carousel/autoplay_config.rb', line 19

def self.coerce(value)
  return new(enabled: value) if value == true || value == false

  dot_duration = value[:dot_duration]
  new(enabled: true, dot_duration: dot_duration == true)
end