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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 650a0838572afc492f7766cfff57ad8ca16d1e52
4
- data.tar.gz: 214852d50263f5f60a4163cc12b45e2d6b327a43
3
+ metadata.gz: 95c0063635d01cefbf8b13f9ddcfd182b26ca813
4
+ data.tar.gz: ba8848c099ce2a893a117504c7b3c35dc9a98668
5
5
  SHA512:
6
- metadata.gz: 432872d1ddca948ffdf9c8681379997932a04267a6599ec716ddb62a6fecaaa3420f1f716af06e32f97584a7a026fc3d36e323bf32d8708fbd88b14bc23b90f0
7
- data.tar.gz: 13ab50e74db4a5a4f856dad456942fbc3459188db3ff98110f93e2ab631d096ff35a54dc14a9a0f303ac7fcc7e6330ecc929cca1ab197a7d0beacf8a9f43696a
6
+ metadata.gz: 36b03720933bad55161fd27024cb91d2d3ea332f53c20a004248576727cc56c0f2b9496a949fe902a83fd7228695c7cb052b919abe1476a9f3e2bc55ebeb1901
7
+ data.tar.gz: 2a9fe5d50851c24b96b3bc2f0d466cf2d33eefbed6ba260dc515c15ad3851dc857aebb6723dbcdd48e74d79c6a4dcd75ea1745a09f27bd5c51e5dccf882c5e26
@@ -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(File.join(@dir, "#{@file}.yml"))
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
 
@@ -1,3 +1,3 @@
1
1
  module Yamload
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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(:loader) { Yamload::Loader.new(:test) }
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Berardi