Class: Enki::Config

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/enki/config.rb

Class Method Summary collapse

Instance Method Summary collapse

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

.defaultObject



19
20
21
# File 'lib/enki/config.rb', line 19

def self.default
  @@default ||= Enki::Config.new(default_location)
end

.default_locationObject



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_idsObject



15
16
17
# File 'lib/enki/config.rb', line 15

def author_open_ids
  [self[:author, :open_id]].flatten.map {|uri| URI.parse(uri)}
end

#comments?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/enki/config.rb', line 27

def comments?
  self[:features, :comments]
end

#tags?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/enki/config.rb', line 31

def tags?
  self[:features, :tags]
end