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.
45 46 47 |
# File 'lib/yandex-delivery.rb', line 45 def initialize(setting) @setting = setting end |
Class Method Details
.build(setting, type) ⇒ Object
35 36 37 |
# File 'lib/yandex-delivery.rb', line 35 def self.build(setting, type) (type ? klass(type) : self).new(setting) end |
.klass(type) ⇒ Object
39 40 41 42 43 |
# File 'lib/yandex-delivery.rb', line 39 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
49 50 51 |
# File 'lib/yandex-delivery.rb', line 49 def value(*_args) @setting end |