Class: YandexDelivery::DynamicSetting
- Inherits:
-
Object
- Object
- YandexDelivery::DynamicSetting
- Defined in:
- lib/yandex_delivery.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(setting) ⇒ DynamicSetting
constructor
A new instance of DynamicSetting.
- #value(*_args) ⇒ Object
Constructor Details
#initialize(setting) ⇒ DynamicSetting
Returns a new instance of DynamicSetting.
89 90 91 |
# File 'lib/yandex_delivery.rb', line 89 def initialize(setting) @setting = setting end |
Class Method Details
.build(setting, type) ⇒ Object
79 80 81 |
# File 'lib/yandex_delivery.rb', line 79 def self.build(setting, type) (type ? klass(type) : self).new(setting) end |
.klass(type) ⇒ Object
83 84 85 86 87 |
# File 'lib/yandex_delivery.rb', line 83 def self.klass(type) klass = "#{type.to_s.camelcase}Setting" raise ArgumentError, "Unknown type: #{type}" unless YandexDelivery.const_defined?(klass) YandexDelivery.const_get(klass) end |
Instance Method Details
#value(*_args) ⇒ Object
93 94 95 |
# File 'lib/yandex_delivery.rb', line 93 def value(*_args) @setting end |