Sha256: 962de086929ebf31532c67796e08830e30a8858f7a85dc24212b676bceb8aa3b
Contents?: true
Size: 1.86 KB
Versions: 15
Compression:
Stored size: 1.86 KB
Contents
# -*- encoding : utf-8 -*- module Blacklight::Configurable extend ActiveSupport::Concern included do helper_method :blacklight_config if respond_to? :helper_method end #instance methods for blacklight_config, default to class # version unless set specifically on instance def blacklight_config @blacklight_config || self.class.blacklight_config end attr_writer :blacklight_config module ClassMethods def copy_blacklight_config_from(other_class) self.blacklight_config = other_class.blacklight_config.inheritable_copy end # 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. def blacklight_config unless (defined? @blacklight_config) if superclass.respond_to?(:blacklight_config) @blacklight_config = superclass.blacklight_config.deep_copy else @blacklight_config = default_configuration end end return @blacklight_config end attr_writer :blacklight_config #simply a convenience method for blacklight_config.configure def configure_blacklight(*args, &block) blacklight_config.configure(*args, &block) end ## # The default configuration object, by default it reads from Blacklight.config for backwards # compatibility with Blacklight <= 3.1 def default_configuration Blacklight::Configurable.default_configuration.inheritable_copy end end def self.default_configuration @default_configuration ||= Blacklight::Configuration.new end def self.default_configuration= config @default_configuration = config end end
Version data entries
15 entries across 15 versions & 1 rubygems