Class: SolidusContent::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_content/configuration.rb

Constant Summary collapse

UnknownProvider =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#skip_default_routeObject

Set to true to prevent SolidusContent from adding the default route. See also the README and config/routes.rb.



20
21
22
# File 'lib/solidus_content/configuration.rb', line 20

def skip_default_route
  @skip_default_route
end

Instance Method Details

#providersObject

Register of content-providers, use symbols for keys and callables as values. Each content-provider will be called passing the ‘entry_options:` and `entry_type_options:`.



12
13
14
15
16
# File 'lib/solidus_content/configuration.rb', line 12

def providers
  @providers ||= Hash.new do |_hash, key|
    raise UnknownProvider, "Can't find a provider for #{key.inspect}"
  end
end

#register_provider(name, provider) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/solidus_content/configuration.rb', line 22

def register_provider(name, provider)
  if provider.is_a? Symbol
    require "solidus_content/providers/#{provider.to_s.underscore}"
    provider = SolidusContent::Providers.const_get(provider)
  end
  providers[name.to_sym] = provider
end