Class: ProconBypassMan::ButtonsSettingConfiguration::ParamNormalizer::IfPressedAllowsFalsy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ IfPressedAllowsFalsy

Returns a new instance of IfPressedAllowsFalsy.



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

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

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

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