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.
52 53 54 |
# File 'lib/ozon-logistics.rb', line 52 def initialize(setting) @setting = setting end |
Class Method Details
.build(setting, type) ⇒ Object
42 43 44 |
# File 'lib/ozon-logistics.rb', line 42 def self.build(setting, type) (type ? klass(type) : self).new(setting) end |
.klass(type) ⇒ Object
46 47 48 49 50 |
# File 'lib/ozon-logistics.rb', line 46 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
56 57 58 |
# File 'lib/ozon-logistics.rb', line 56 def value(*_args) @setting end |