Class: OzonLogistics::DynamicSetting
- Inherits:
-
Object
- Object
- OzonLogistics::DynamicSetting
- Defined in:
- lib/ozon-logistics.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.
51 52 53 |
# File 'lib/ozon-logistics.rb', line 51 def initialize(setting) @setting = setting end |
Class Method Details
.build(setting, type) ⇒ Object
41 42 43 |
# File 'lib/ozon-logistics.rb', line 41 def self.build(setting, type) (type ? klass(type) : self).new(setting) end |
.klass(type) ⇒ Object
45 46 47 48 49 |
# File 'lib/ozon-logistics.rb', line 45 def self.klass(type) klass = "#{type.to_s.camelcase}Setting" raise ArgumentError, "Unknown type: #{type}" unless OzonLogistics.const_defined?(klass) OzonLogistics.const_get(klass) end |
Instance Method Details
#value(*_args) ⇒ Object
55 56 57 |
# File 'lib/ozon-logistics.rb', line 55 def value(*_args) @setting end |