Class: Lifer::Config
- Inherits:
-
Object
- Object
- Lifer::Config
- Defined in:
- lib/lifer/config.rb
Constant Summary collapse
- DEFAULT =
"%s/templates/config" % File.(File.dirname(__FILE__))
- REGISTERED_SETTINGS =
[ :output_directory, :uri_strategy ]
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
23 24 25 |
# File 'lib/lifer/config.rb', line 23 def file @file end |
Class Method Details
.build(file:) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/lifer/config.rb', line 12 def build(file:) if File.file? file new file: file else puts "No configuration file at #{file}. Using default configuration." new file: DEFAULT end end |
Instance Method Details
#collections ⇒ Object
25 26 27 |
# File 'lib/lifer/config.rb', line 25 def collections raw.keys.select { |setting| has_settings? setting } end |
#settings ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/lifer/config.rb', line 29 def settings raw.select { |setting, _| if REGISTERED_SETTINGS.include? setting true elsif has_settings? setting true end } end |