Class: HumpyardForm::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/humpyard_form/config.rb

Overview

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

Possible configuration options are:

table_name_prefix

The prefix for the SQL tables

The default value is "humpyard_form_"

admin_prefix

The prefix for the admin controllers

The default value is "admin"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Config

:nodoc:



19
20
21
# File 'lib/humpyard_form/config.rb', line 19

def initialize(&block) #:nodoc:
  configure(&block) if block_given?
end

Instance Attribute Details

#collection_label_methodsObject



43
44
45
# File 'lib/humpyard_form/config.rb', line 43

def collection_label_methods
  @collection_label_methods ||= %w[to_label display_name full_name name title username login value to_s]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

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

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/humpyard_form/config.rb', line 25

def configure(&block)
  yield(self)
end

#localesObject

:nodoc:



39
40
41
# File 'lib/humpyard_form/config.rb', line 39

def locales #:nodoc:
  @locales ||= [:en]
end

#locales=(locales) ⇒ Object

:nodoc:



29
30
31
32
33
34
35
36
37
# File 'lib/humpyard_form/config.rb', line 29

def locales=(locales) #:nodoc:
  if locales.nil? 
    @locales = nil
  elsif locales.class == Array
    @locales = locales.map{|l| l.to_sym}
  else
    @locales = locales.split(',').collect{|l| l.to_sym}
  end
end