Class: Conjure::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/conjure/config.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Config
Returns a new instance of Config.
11
12
13
14
|
# File 'lib/conjure/config.rb', line 11
def initialize(options)
@options = options
find_default_keys unless @options["private_key"]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
16
17
18
19
|
# File 'lib/conjure/config.rb', line 16
def method_missing(name)
return @options[name.to_s] if @options.has_key? name.to_s
super
end
|
Class Method Details
.load(root_path) ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/conjure/config.rb', line 3
def self.load(root_path)
require "ostruct"
config_path = File.join root_path, "config", "conjure.yml"
data = YAML.load_file config_path
data["config_path"] = File.dirname config_path
new data
end
|
Instance Method Details
#file_contents(name) ⇒ Object
21
22
23
24
25
|
# File 'lib/conjure/config.rb', line 21
def file_contents(name)
name = @options[name.to_s] if name.is_a? Symbol
name = File.join(@options["config_path"], name) unless name[0] == "/"
File.open name, "rb", &:read
end
|