Class: Staticpress::Configuration
- Inherits:
-
JSObject
- Object
- OpenStruct
- JSObject
- Staticpress::Configuration
show all
- Defined in:
- lib/staticpress/configuration.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from JSObject
#-, #[], #merge, new, #to_hash
Class Method Details
.default ⇒ Object
14
15
16
|
# File 'lib/staticpress/configuration.rb', line 14
def self.default
@default ||= new(YAML.load_file(Staticpress.root + 'skeleton' + 'config.yml'))
end
|
.instance ⇒ Object
18
19
20
21
22
|
# File 'lib/staticpress/configuration.rb', line 18
def self.instance
custom_file = Staticpress.blog_path + 'config.yml'
custom = custom_file.file? ? YAML.load_file(custom_file) : {}
new(default.to_hash.merge(custom))
end
|
Instance Method Details
#save ⇒ Object
7
8
9
10
11
12
|
# File 'lib/staticpress/configuration.rb', line 7
def save
(Staticpress.blog_path + 'config.yml').open('w') do |f|
custom_values = self - self.class.default
YAML.dump(custom_values.to_hash, f)
end
end
|