Class: Loaf::Configuration
- Inherits:
-
Object
- Object
- Loaf::Configuration
- Defined in:
- lib/loaf/configuration.rb
Constant Summary collapse
- VALID_ATTRIBUTES =
[ :locales_path, :style_classes, :crumb_length, :last_crumb_linked, :capitalize, :root ]
- DEFAULT_LOCALES_PATH =
'/'
- DEFAULT_STYLE_CLASSES =
'selected'
- DEFAULT_CRUMB_LENGTH =
30
- DEFAULT_LAST_CRUMB_LINKED =
false
- DEFAULT_CAPITALIZE =
false
- DEFAULT_ROOT =
true
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Setup this configuration.
-
#to_hash ⇒ Hash
Convert all properties into hash.
Constructor Details
#initialize ⇒ Configuration
Setup this configuration
31 32 33 34 35 |
# File 'lib/loaf/configuration.rb', line 31 def initialize VALID_ATTRIBUTES.each do |attr| send("#{attr}=", self.class.const_get("DEFAULT_#{attr.to_s.upcase}")) end end |
Instance Method Details
#to_hash ⇒ Hash
Convert all properties into hash
42 43 44 |
# File 'lib/loaf/configuration.rb', line 42 def to_hash VALID_ATTRIBUTES.reduce({}) { |acc, k| acc[k] = send(k); acc } end |