Class: ActiveAdmin::DynamicSettingsNode
- Inherits:
-
SettingsNode
- Object
- SettingsNode
- ActiveAdmin::DynamicSettingsNode
- Defined in:
- lib/active_admin/dynamic_settings_node.rb
Direct Known Subclasses
Class Method Summary collapse
- .add_reader(name) ⇒ Object
- .add_writer(name, type) ⇒ Object
- .register(name, value, type = nil) ⇒ Object
Methods inherited from SettingsNode
Class Method Details
.add_reader(name) ⇒ Object
16 17 18 19 20 |
# File 'lib/active_admin/dynamic_settings_node.rb', line 16 def add_reader(name) define_singleton_method(name) do |*args| send(:"#{name}_setting").value(*args) end end |
.add_writer(name, type) ⇒ Object
22 23 24 25 26 |
# File 'lib/active_admin/dynamic_settings_node.rb', line 22 def add_writer(name, type) define_singleton_method(:"#{name}=") do |value| send(:"#{name}_setting=", DynamicSetting.build(value, type)) end end |
.register(name, value, type = nil) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/active_admin/dynamic_settings_node.rb', line 9 def register(name, value, type = nil) class_attribute "#{name}_setting" add_reader(name) add_writer(name, type) send :"#{name}=", value end |