Class: Enki::Config
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Enki::Config
- Defined in:
- lib/enki/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](*path) ⇒ Object
- #author_open_ids ⇒ Object
- #comments? ⇒ Boolean
-
#initialize(file_name) ⇒ Config
constructor
A new instance of Config.
- #tags? ⇒ Boolean
Constructor Details
#initialize(file_name) ⇒ Config
Returns a new instance of Config.
5 6 7 |
# File 'lib/enki/config.rb', line 5 def initialize(file_name) super(symbolize_keys(YAML::load(IO.read(file_name)))) end |
Class Method Details
.default ⇒ Object
19 20 21 |
# File 'lib/enki/config.rb', line 19 def self.default @@default ||= Enki::Config.new(default_location) end |
.default_location ⇒ Object
23 24 25 |
# File 'lib/enki/config.rb', line 23 def self.default_location "#{Rails.root}/config/enki.yml" end |
Instance Method Details
#[](*path) ⇒ Object
9 10 11 12 13 |
# File 'lib/enki/config.rb', line 9 def [](*path) path.inject(__getobj__()) {|config, item| config[item] } end |
#author_open_ids ⇒ Object
15 16 17 |
# File 'lib/enki/config.rb', line 15 def [self[:author, :open_id]].flatten.map {|uri| URI.parse(uri)} end |
#comments? ⇒ Boolean
27 28 29 |
# File 'lib/enki/config.rb', line 27 def comments? self[:features, :comments] end |
#tags? ⇒ Boolean
31 32 33 |
# File 'lib/enki/config.rb', line 31 def self[:features, :tags] end |