yamload 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yamload/loader.rb +9 -1
- data/lib/yamload/version.rb +1 -1
- data/spec/loader_spec.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95c0063635d01cefbf8b13f9ddcfd182b26ca813
|
4
|
+
data.tar.gz: ba8848c099ce2a893a117504c7b3c35dc9a98668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b03720933bad55161fd27024cb91d2d3ea332f53c20a004248576727cc56c0f2b9496a949fe902a83fd7228695c7cb052b919abe1476a9f3e2bc55ebeb1901
|
7
|
+
data.tar.gz: 2a9fe5d50851c24b96b3bc2f0d466cf2d33eefbed6ba260dc515c15ad3851dc857aebb6723dbcdd48e74d79c6a4dcd75ea1745a09f27bd5c51e5dccf882c5e26
|
data/lib/yamload/loader.rb
CHANGED
@@ -9,6 +9,10 @@ module Yamload
|
|
9
9
|
@dir = dir
|
10
10
|
end
|
11
11
|
|
12
|
+
def exist?
|
13
|
+
File.exist?(filepath)
|
14
|
+
end
|
15
|
+
|
12
16
|
def loaded_hash
|
13
17
|
@loaded_hash ||= IceNine.deep_freeze(defaults.deep_merge(load))
|
14
18
|
end
|
@@ -53,7 +57,11 @@ module Yamload
|
|
53
57
|
private
|
54
58
|
|
55
59
|
def load
|
56
|
-
YAML.load_file(
|
60
|
+
YAML.load_file(filepath)
|
61
|
+
end
|
62
|
+
|
63
|
+
def filepath
|
64
|
+
File.join(@dir, "#{@file}.yml")
|
57
65
|
end
|
58
66
|
end
|
59
67
|
|
data/lib/yamload/version.rb
CHANGED
data/spec/loader_spec.rb
CHANGED
@@ -3,7 +3,16 @@ require 'spec_helper'
|
|
3
3
|
require 'yamload'
|
4
4
|
|
5
5
|
describe Yamload do
|
6
|
-
let(:
|
6
|
+
let(:file) { :test }
|
7
|
+
let(:loader) { Yamload::Loader.new(file) }
|
8
|
+
|
9
|
+
specify { expect(loader).to exist }
|
10
|
+
|
11
|
+
context 'with a non existing file' do
|
12
|
+
let(:file) { :non_existing }
|
13
|
+
specify { expect(loader).not_to exist }
|
14
|
+
end
|
15
|
+
|
7
16
|
let(:config) { loader.loaded_hash }
|
8
17
|
let(:config_obj) { loader.obj }
|
9
18
|
|