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