Class: ProconBypassMan::ButtonsSettingConfiguration::ParamNormalizer::ButtonList

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(button) ⇒ ButtonList

Returns a new instance of ButtonList.



7
8
9
# File 'lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb', line 7

def initialize(button)
  @button = button
end

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



5
6
7
# File 'lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb', line 5

def button
  @button
end

Instance Method Details

#to_value!Array

Returns:

  • (Array)

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb', line 14

def to_value!
  case button
  when Integer, TrueClass, FalseClass, NilClass
    raise UnSupportValueError
  when Symbol
    return [button]
  when String
    return [button.to_sym]
  when Array
    return button.map(&:to_sym).uniq
  else
    raise UnexpectedValueError
  end
end