Sha256: a785bb0ed6c6c6a3ddc600db59fd726e01d3c3c65b1b96097198e7cb57317765

Contents?: true

Size: 686 Bytes

Versions: 31

Compression:

Stored size: 686 Bytes

Contents

require 'active_admin/dynamic_setting'
require 'active_admin/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

31 entries across 31 versions & 4 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/dynamic_settings_node.rb
activeadmin-rails-1.7.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-rb-1.6.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-rb-1.5.2 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.8.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-rb-1.5.1 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.7.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.6.1 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.6.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.5.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.4.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.3.1 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.3.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.2.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.1.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.0.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-rb-1.5.0 lib/active_admin/dynamic_settings_node.rb
activeadmin-2.0.0.rc2 lib/active_admin/dynamic_settings_node.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/active_admin/dynamic_settings_node.rb
activeadmin-2.0.0.rc1 lib/active_admin/dynamic_settings_node.rb