Class: AmocrmRails::DynamicSetting
- Inherits:
-
Object
- Object
- AmocrmRails::DynamicSetting
- Defined in:
- lib/amocrm-rails.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.
93 94 95 |
# File 'lib/amocrm-rails.rb', line 93 def initialize(setting) @setting = setting end |
Class Method Details
.build(setting, type) ⇒ Object
83 84 85 |
# File 'lib/amocrm-rails.rb', line 83 def self.build(setting, type) (type ? klass(type) : self).new(setting) end |
.klass(type) ⇒ Object
87 88 89 90 91 |
# File 'lib/amocrm-rails.rb', line 87 def self.klass(type) klass = "#{type.to_s.camelcase}Setting" raise ArgumentError, "Unknown type: #{type}" unless AmocrmRails.const_defined?(klass) AmocrmRails.const_get(klass) end |
Instance Method Details
#value(*_args) ⇒ Object
97 98 99 |
# File 'lib/amocrm-rails.rb', line 97 def value(*_args) @setting end |