Class: ProconBypassMan::ButtonsSettingConfiguration::ParamNormalizer::Button

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(button) ⇒ Button

Returns a new instance of Button.



7
8
9
# File 'lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.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.rb', line 5

def button
  @button
end

Instance Method Details

#to_value!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.rb', line 11

def to_value!
  case button
  when TrueClass, FalseClass, NilClass, Array, Integer
    raise UnSupportValueError
  when Symbol, String
    unless !!ProconBypassMan::Procon::ButtonCollection::BUTTONS_MAP[button.to_sym]
      raise UnexpectedValueError
    end

    return button.to_sym
  else
    raise UnexpectedValueError
  end
end