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.
15
16
17
18
|
# File 'lib/conjure/config.rb', line 15
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
20
21
22
|
# File 'lib/conjure/config.rb', line 20
def method_missing(name)
@options[name.to_s]
end
|
Class Method Details
.load(root_path) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/conjure/config.rb', line 3
def self.load(root_path)
require "ostruct"
config_path = File.join root_path, "config", "conjure.yml"
if File.exists? config_path
data = YAML.load_file config_path
data["config_path"] = File.dirname config_path
else
data = {}
end
new data
end
|
Instance Method Details
#file_contents(name) ⇒ Object
24
25
26
27
28
|
# File 'lib/conjure/config.rb', line 24
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
|