Class: Matrixeval::Config::YAML
- Inherits:
-
Object
- Object
- Matrixeval::Config::YAML
show all
- Defined in:
- lib/matrixeval/config/yaml.rb
Defined Under Namespace
Classes: MissingError, MissingTargetGem
Class Method Summary
collapse
Class Method Details
.[](key) ⇒ Object
28
29
30
|
# File 'lib/matrixeval/config/yaml.rb', line 28
def [](key)
yaml[key]
end
|
.create_for(target_name) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/matrixeval/config/yaml.rb', line 12
def create_for(target_name)
return if File.exist?(path)
require "matrixeval/#{target_name}" unless target_name.nil?
FileUtils.cp(
target(target_name).matrixeval_yml_template_path,
path
)
rescue LoadError
raise MissingTargetGem.new("Missing gem for the target #{target_name}")
end
|
.path ⇒ Object
24
25
26
|
# File 'lib/matrixeval/config/yaml.rb', line 24
def path
Matrixeval.working_dir.join("matrixeval.yml")
end
|
.yaml ⇒ Object
32
33
34
35
36
|
# File 'lib/matrixeval/config/yaml.rb', line 32
def yaml
raise MissingError unless File.exist?(path)
::YAML.load File.read(path)
end
|