shutl_yaml_properties 0.0.13 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjIwZDAxMDI2NTk5YWM1NWFhYmY1MDBlNGU4YTFlOTIwYzI3MzY4MA==
5
+ data.tar.gz: !binary |-
6
+ MTVmZjIwOTNmOGNhOTE2NTA3YzJlNzRkM2Q4YmIxNGUyMDViNGM3ZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTVhZDEwMDBhZTE4ZGI3YzgzYWY3OGFmYWQ2YzgzYmQzYzZiOTY5ZTFlM2Yx
10
+ ZGY4NzI0M2EwNGZkOWMwYWQ4YjU3NmUzNmE4YTUyMjk5Y2RhMzM3MTFmZjEz
11
+ YzNkOGNlYTA0YzI1OWI3NWI2Njk2NGYyOTYwZDE0N2Q4N2ZhM2E=
12
+ data.tar.gz: !binary |-
13
+ ZDVlYWQ3M2I5NDliNzkzZmJlZWRiM2YxN2MxMGIwNWYyYWJjODM4M2UzZWNj
14
+ MGU5YTE4YmIwOTlhMDFhNjg4M2I5MTY5ZDVjYjJiNDg3ZDVhNzczZTBmMmQw
15
+ ZTVhOGM4NzRmNDRmODZjNGIyM2IyYzVjOWUyNjRlYTA1OWUxOTM=
@@ -26,6 +26,9 @@ module YamlProperties
26
26
  super key, *args, &block
27
27
  end
28
28
 
29
+ def fetch(key, default = nil)
30
+ key_present?(key) ? properties[key] : default
31
+ end
29
32
 
30
33
  def override_attribute attribute, value
31
34
  unless key_present? attribute
@@ -1,3 +1,3 @@
1
1
  module YamlProperties
2
- VERSION = "0.0.13"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -92,6 +92,20 @@ describe YamlProperties do
92
92
  Acme.life_the_universe_and_everything.should == 42
93
93
  end
94
94
  end
95
+
96
+ context "default behaviour" do
97
+ context "existing key" do
98
+ specify do
99
+ YamlProperties.fetch("some_string_value", "foo").should == "something"
100
+ end
101
+ end
102
+
103
+ context "non existent key" do
104
+ specify do
105
+ YamlProperties.fetch("non existent key", "foo").should == "foo"
106
+ end
107
+ end
108
+ end
95
109
  end
96
110
 
97
111
  context "overriding yaml_file default" do
@@ -27,7 +27,6 @@ Gem::Specification.new do |gem|
27
27
  gem.add_dependency 'activesupport'
28
28
 
29
29
  gem.add_development_dependency 'rspec'
30
- gem.add_development_dependency 'debugger', '~> 1.4.0'
31
30
 
32
31
  gem.files = `git ls-files`.split($/)
33
32
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shutl_yaml_properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mark Burns
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-11-29 00:00:00.000000000 Z
12
+ date: 2015-08-19 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activesupport
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: rspec
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,27 +35,10 @@ dependencies:
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
46
41
  version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: debugger
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 1.4.0
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 1.4.0
63
42
  description: Easily add configurable variables for app config using YAML files
64
43
  email:
65
44
  - markthedeveloper@gmail.com
@@ -97,33 +76,26 @@ files:
97
76
  - yaml_properties.gemspec
98
77
  homepage: ''
99
78
  licenses: []
79
+ metadata: {}
100
80
  post_install_message:
101
81
  rdoc_options: []
102
82
  require_paths:
103
83
  - lib
104
84
  required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
85
  requirements:
107
86
  - - ! '>='
108
87
  - !ruby/object:Gem::Version
109
88
  version: '0'
110
- segments:
111
- - 0
112
- hash: 2433610047750443937
113
89
  required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
90
  requirements:
116
91
  - - ! '>='
117
92
  - !ruby/object:Gem::Version
118
93
  version: '0'
119
- segments:
120
- - 0
121
- hash: 2433610047750443937
122
94
  requirements: []
123
95
  rubyforge_project:
124
- rubygems_version: 1.8.23
96
+ rubygems_version: 2.4.3
125
97
  signing_key:
126
- specification_version: 3
98
+ specification_version: 4
127
99
  summary: ! 'Example: YamlProperties.life_the_universe_and_everything #=> 42 In config/properties.yml
128
100
  life_the_universe_and_everything: 42'
129
101
  test_files: