Class: ProconBypassMan::ButtonsSettingConfiguration::ParamNormalizer::ForceNeutral

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(force_neutral) ⇒ ForceNeutral

Returns a new instance of ForceNeutral.



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

def initialize(force_neutral)
  @force_neutral = force_neutral
end

Instance Attribute Details

#force_neutralObject (readonly)

Returns the value of attribute force_neutral.



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

def force_neutral
  @force_neutral
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/force_neutral.rb', line 11

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