Class: Nesta::Config
- Inherits:
-
Object
- Object
- Nesta::Config
- Defined in:
- lib/nesta/config.rb
Defined Under Namespace
Classes: NotDefined
Class Attribute Summary collapse
-
.author_settings ⇒ Object
Returns the value of attribute author_settings.
-
.settings ⇒ Object
Returns the value of attribute settings.
-
.yaml_conf ⇒ Object
Returns the value of attribute yaml_conf.
Class Method Summary collapse
- .attachment_path(basename = nil) ⇒ Object
- .author ⇒ Object
- .cache ⇒ Object
- .content_path(basename = nil) ⇒ Object
- .fetch(key, *default) ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .page_path(basename = nil) ⇒ Object
- .read_more ⇒ Object
- .yaml_path ⇒ Object
Class Attribute Details
.author_settings ⇒ Object
Returns the value of attribute author_settings.
21 22 23 |
# File 'lib/nesta/config.rb', line 21 def @author_settings end |
.settings ⇒ Object
Returns the value of attribute settings.
21 22 23 |
# File 'lib/nesta/config.rb', line 21 def settings @settings end |
.yaml_conf ⇒ Object
Returns the value of attribute yaml_conf.
21 22 23 |
# File 'lib/nesta/config.rb', line 21 def yaml_conf @yaml_conf end |
Class Method Details
.attachment_path(basename = nil) ⇒ Object
66 67 68 |
# File 'lib/nesta/config.rb', line 66 def self.(basename = nil) get_path(File.join(content_path, "attachments"), basename) end |
.author ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nesta/config.rb', line 42 def self. environment_config = {} %w[name uri email].each do |setting| variable = "NESTA_AUTHOR__#{setting.upcase}" ENV[variable] && environment_config[setting] = ENV[variable] end environment_config.empty? ? from_yaml('author') : environment_config rescue NotDefined nil end |
.cache ⇒ Object
53 54 55 56 |
# File 'lib/nesta/config.rb', line 53 def self.cache Nesta.deprecated('Nesta::Config.cache', 'see http://nestacms.com/docs/deployment/page-caching') end |
.content_path(basename = nil) ⇒ Object
58 59 60 |
# File 'lib/nesta/config.rb', line 58 def self.content_path(basename = nil) get_path(content, basename) end |
.fetch(key, *default) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/nesta/config.rb', line 24 def self.fetch(key, *default) from_environment(key.to_s) rescue NotDefined begin from_yaml(key.to_s) rescue NotDefined default.empty? && raise || (return default.first) end end |
.method_missing(method, *args) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/nesta/config.rb', line 34 def self.method_missing(method, *args) if settings.include?(method.to_s) fetch(method, nil) else super end end |
.page_path(basename = nil) ⇒ Object
62 63 64 |
# File 'lib/nesta/config.rb', line 62 def self.page_path(basename = nil) get_path(File.join(content_path, "pages"), basename) end |
.read_more ⇒ Object
74 75 76 |
# File 'lib/nesta/config.rb', line 74 def self.read_more fetch('read_more', 'Continue reading') end |