Class: DaazwebApi::DynamicSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/daazweb-api.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(setting) ⇒ DynamicSetting

Returns a new instance of DynamicSetting.



50
51
52
# File 'lib/daazweb-api.rb', line 50

def initialize(setting)
  @setting = setting
end

Class Method Details

.build(setting, type) ⇒ Object



40
41
42
# File 'lib/daazweb-api.rb', line 40

def self.build(setting, type)
  (type ? klass(type) : self).new(setting)
end

.klass(type) ⇒ Object

Raises:

  • (ArgumentError)


44
45
46
47
48
# File 'lib/daazweb-api.rb', line 44

def self.klass(type)
  klass = "#{type.to_s.camelcase}Setting"
  raise ArgumentError, "Unknown type: #{type}" unless DaazwebApi.const_defined?(klass)
  DaazwebApi.const_get(klass)
end

Instance Method Details

#value(*_args) ⇒ Object



54
55
56
# File 'lib/daazweb-api.rb', line 54

def value(*_args)
  @setting
end