class Humpyard::Config

Humpyard::Config is responsible for holding and managing the configuration for your Humpyard Rails Application.

Possible configuration options are:

table_name_prefix

The prefix for the SQL tables

The default value is "humpyard_"

www_prefix

The prefix for the pages in your routes

You may use some variables that will be replaced by Humpyard::Page#human_url

":locale"

The current ::I18n.locale

Leading slashes (“/”) as it would result in invalid URLs and will be ignored.

A tailing slash (“/”) indicates, that the value should be a path. Without the tailing slash the last part would become a prefix to the pages URL. A page with the path “about/config.html” with the ::I18n.locale=“en” and the given prefix will result in:

":locale/"

"/en/about/config.html"

":locale/cms_"

"/en/cms_about_config.html"

"cms/"

"/cms/about/config.html"

"": "/about/config.html"

The default value is ":locale/"

admin_prefix

The prefix for the admin controllers

The default value is "admin"

locales

The locales used for the pages

This option can be configured by giving an Array or comma separated String, e.g. 'en,de,fr' or ['en', 'de', 'fr'].

Setting this option will also alter the HumpyardForm.config.locales to the given value

The default value is ['en']

Public Instance Methods

admin_prefix=(prefix) click to toggle source
# File lib/humpyard/config.rb, line 166
def admin_prefix=(prefix)
  if prefix
    @admin_prefix = prefix.gsub /^\//, ''
  else
    @admin_prefix = nil
  end
end
compass_format() click to toggle source
# File lib/humpyard/config.rb, line 206
def compass_format
  @compass_format ||= 'scss'
end
configure() { |self| ... } click to toggle source

Configure your Humpyard Rails Application with the given parameters in the block. For possible options see above.

# File lib/humpyard/config.rb, line 57
def configure(&block)
  yield(self)
end
default_template_name() click to toggle source
# File lib/humpyard/config.rb, line 138
def default_template_name
  default_template.to_s
end
js_framework() click to toggle source
# File lib/humpyard/config.rb, line 202
def js_framework
  @js_framework ||= 'jquery-ui-18'
end
locales_contraint() click to toggle source

Get the given locales as Regexp constraint. This may be used to see if a locale matches the configured locales. Usage is e.g. in the routes.

# File lib/humpyard/config.rb, line 194
def locales_contraint
  Regexp.new locales * '|'
end
page_formats_contraint() click to toggle source

Get the given locales as Regexp constraint. This may be used to see if a locale matches the configured locales. Usage is e.g. in the routes.

# File lib/humpyard/config.rb, line 231
def page_formats_contraint
  Regexp.new page_formats * '|'
end
parsed_www_prefix(params) click to toggle source

Get the prefix of your pages with interpreted variables given as params. You normally don't want to call it yourself. Instead use the Humpyard::Page#human_url which will put the current ::I18n.locale into the params.

# File lib/humpyard/config.rb, line 154
def parsed_www_prefix(params)
  prefix = "#{www_prefix}"
  params.each do |key,value|
    prefix.gsub!(":#{key}", value.to_s)
  end
  prefix
end
users_framework() click to toggle source
# File lib/humpyard/config.rb, line 198
def users_framework
  @users_framework ||= 'simple'
end
www_prefix=(prefix) click to toggle source
# File lib/humpyard/config.rb, line 69
def www_prefix=(prefix)
  if prefix
    @www_prefix = prefix.gsub /^\//, ''
  else
    @www_prefix = nil
  end
end