Module: RailsAdmin::Config::Configurable

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



8
9
10
# File 'lib/rails_admin/config/configurable.rb', line 8

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

Instance Method Details

#has_option?(name) ⇒ Boolean

rubocop:disable Naming/PredicateName

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/rails_admin/config/configurable.rb', line 12

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

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



23
24
25
26
# File 'lib/rails_admin/config/configurable.rb', line 23

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



18
19
20
21
# File 'lib/rails_admin/config/configurable.rb', line 18

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