Module: Configurable
- Included in:
- Steamworks::Configure
- Defined in:
- lib/steamworks/core_ext/configurable.rb
Overview
Instance Method Summary collapse
-
#set(option, value = (not_set = true), read_only: false) ⇒ nil
Sets an option to the given value.
Instance Method Details
#set(option, value = (not_set = true), read_only: false) ⇒ nil
Sets an option to the given value.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/steamworks/core_ext/configurable.rb', line 11 def set(option, value = (not_set = true), read_only: false) raise ArgumentError if not_set setter = proc { |val| set option, val } getter = proc { value } define_singleton("#{option}=", setter) unless read_only define_singleton(option, getter) define_singleton("#{option}?", "!!#{option}") unless method_defined? "#{option}?" self end |