Class: Sblogistica::DynamicSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/sblogistica.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(setting) ⇒ DynamicSetting

Returns a new instance of DynamicSetting.



65
66
67
# File 'lib/sblogistica.rb', line 65

def initialize(setting)
  @setting = setting
end

Class Method Details

.build(setting, type) ⇒ Object



55
56
57
# File 'lib/sblogistica.rb', line 55

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

.klass(type) ⇒ Object

Raises:

  • (ArgumentError)


59
60
61
62
63
# File 'lib/sblogistica.rb', line 59

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

Instance Method Details

#value(*_args) ⇒ Object



69
70
71
# File 'lib/sblogistica.rb', line 69

def value(*_args)
  @setting
end