lib/loaf/configuration.rb in loaf-0.5.0 vs lib/loaf/configuration.rb in loaf-0.6.0
- old
+ new
@@ -1,17 +1,14 @@
-# encoding: utf-8
+# frozen_string_literal: true
module Loaf
class Configuration
VALID_ATTRIBUTES = [
:locales_path,
- :style_classes,
:crumb_length,
- :last_crumb_linked,
- :capitalize,
- :root
- ]
+ :capitalize
+ ].freeze
attr_accessor(*VALID_ATTRIBUTES)
DEFAULT_LOCALES_PATH = '/'
@@ -26,12 +23,14 @@
DEFAULT_ROOT = true
# Setup this configuration
#
# @api public
- def initialize
+ def initialize(attributes = {})
VALID_ATTRIBUTES.each do |attr|
- send("#{attr}=", self.class.const_get("DEFAULT_#{attr.to_s.upcase}"))
+ default = self.class.const_get("DEFAULT_#{attr.to_s.upcase}")
+ attr_value = attributes.fetch(attr) { default }
+ send("#{attr}=", attr_value)
end
end
# Convert all properties into hash
#