Module: Blacklight::Configurable::ClassMethods
- Defined in:
- app/models/concerns/blacklight/configurable.rb
Instance Attribute Summary collapse
-
#blacklight_config ⇒ Object
lazy load a deep_copy of superclass if present, else a default_configuration, which will be legacy load or new empty config.
Instance Method Summary collapse
-
#configure_blacklight(*args, &block) ⇒ Object
simply a convenience method for blacklight_config.configure.
- #copy_blacklight_config_from(other_class) ⇒ Object
-
#default_configuration ⇒ Object
The default configuration object.
Instance Attribute Details
#blacklight_config ⇒ Object
lazy load a deep_copy of superclass if present, else a default_configuration, which will be legacy load or new empty config. note the @blacklight_config variable is a ruby 'instance method on class object' that won't be automatically available to subclasses, that's why we lazy load to 'inherit' how we want.
25 26 27 28 29 30 31 |
# File 'app/models/concerns/blacklight/configurable.rb', line 25 def blacklight_config @blacklight_config ||= if superclass.respond_to?(:blacklight_config) superclass.blacklight_config.deep_copy else default_configuration end end |
Instance Method Details
#configure_blacklight(*args, &block) ⇒ Object
simply a convenience method for blacklight_config.configure
35 36 37 |
# File 'app/models/concerns/blacklight/configurable.rb', line 35 def configure_blacklight(*args, &block) blacklight_config.configure(*args, &block) end |
#copy_blacklight_config_from(other_class) ⇒ Object
16 17 18 |
# File 'app/models/concerns/blacklight/configurable.rb', line 16 def copy_blacklight_config_from(other_class) self.blacklight_config = other_class.blacklight_config.inheritable_copy end |
#default_configuration ⇒ Object
The default configuration object
41 42 43 |
# File 'app/models/concerns/blacklight/configurable.rb', line 41 def default_configuration Blacklight::Configurable.default_configuration.inheritable_copy end |