Class: Locomotive::Configuration

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

Constant Summary collapse

@@default_locales =
%w{en de fr bg cs da el es ca fa-IR fi-FI it ja-JP lt nl pl-PL pt pt-BR ru sv sv-FI uk zh-CN}
@@site_locales =
@@default_locales + %w{hr et nb sk sl sr}
@@defaults =
{
  name:                         'Locomotive',
  host:                         nil,
  # forbidden_paths:            %w{layouts snippets stylesheets javascripts assets admin system api},
  reserved_site_handles:        %w(sites my_account password sign_in sign_out),
  reserved_slugs:               %w{stylesheets javascripts assets admin locomotive images api pages edit},
  reserved_domains:             [],
  locales:                      @@default_locales,
  site_locales:                 @@site_locales,
  cookie_key:                   '_locomotive_session',
  enable_logs:                  false,
  enable_admin_ssl:             false,
  delayed_job:                  false,
  default_locale:               :en,
  mailer_sender:                '[email protected]',
  unsafe_token_authentication:  false,
  enable_registration:          true,
  optimize_uploaded_files:      false,
  ui:                     {
    per_page:     10
  },
  rack_cache:             {
    verbose:      true,
    metastore:    URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
    entitystore:  URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
  },
  devise_modules:               [:registerable, :rememberable, :database_authenticatable, :recoverable, :trackable, :validatable, :encryptable, { encryptor: :sha1 }],
  steam_image_resizer_secret:   'please change it'
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



39
40
41
# File 'lib/locomotive/configuration.rb', line 39

def initialize
  @@settings = self.class.get_from_hash(@@defaults)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



47
48
49
# File 'lib/locomotive/configuration.rb', line 47

def method_missing(name, *args, &block)
  self.settings.send(name, *args, &block)
end

Class Method Details

.settingsObject



43
44
45
# File 'lib/locomotive/configuration.rb', line 43

def self.settings
  @@settings
end

Instance Method Details

#respond_to?(name, include_all = false) ⇒ Boolean

Returns:



51
52
53
# File 'lib/locomotive/configuration.rb', line 51

def respond_to?(name, include_all = false)
  self.settings.keys.include?(name.to_sym) || super
end