Module: RailsAdmin::Config::Configurable

Included in:
Actions::Base, Fields::Base, Fields::Group, Fields::Types::MultipleFileUpload::AbstractAttachment, Model, Sections::Base
Defined in:
lib/rails_admin/config/configurable.rb

Overview

A module for all configurables.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/rails_admin/config/configurable.rb', line 6

def self.included(base)
  base.send :extend, ClassMethods
end

Instance Method Details

#has_option?(name) ⇒ Boolean

rubocop:disable Naming/PredicateName

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/rails_admin/config/configurable.rb', line 10

def has_option?(name) # rubocop:disable Naming/PredicateName
  options = self.class.instance_variable_get('@config_options')
  options && options.key?(name)
end

#register_deprecated_instance_option(option_name, replacement_option_name = nil, &custom_error) ⇒ Object



21
22
23
24
# File 'lib/rails_admin/config/configurable.rb', line 21

def register_deprecated_instance_option(option_name, replacement_option_name = nil, &custom_error)
  scope = class << self; self; end
  self.class.register_deprecated_instance_option(option_name, replacement_option_name, scope, &custom_error)
end

#register_instance_option(option_name, &default) ⇒ Object

Register an instance option for this object only



16
17
18
19
# File 'lib/rails_admin/config/configurable.rb', line 16

def register_instance_option(option_name, &default)
  scope = class << self; self; end
  self.class.register_instance_option(option_name, scope, &default)
end