Sha256: a4dc2b751793272eb15817b2cc34a90bbc1330d33115d735f637b3992931c43a
Contents?: true
Size: 712 Bytes
Versions: 3
Compression:
Stored size: 712 Bytes
Contents
# frozen_string_literal: true require_relative "dynamic_setting" require_relative "settings_node" module ActiveAdmin class DynamicSettingsNode < SettingsNode class << self def register(name, value, type = nil) class_attribute "#{name}_setting" add_reader(name) add_writer(name, type) send :"#{name}=", value end def add_reader(name) define_singleton_method(name) do |*args| send(:"#{name}_setting").value(*args) end end def add_writer(name, type) define_singleton_method(:"#{name}=") do |value| send(:"#{name}_setting=", DynamicSetting.build(value, type)) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems