data_set 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +33 -24
- data/Gemfile +2 -1
- data/{LICENSE.txt → LICENSE.md} +0 -0
- data/README.md +20 -8
- data/Rakefile +1 -0
- data/data/yaml/test_data.yml +1 -1
- data/data_set.gemspec +1 -1
- data/lib/data_set.rb +1 -1
- data/lib/data_set/data_accessor.rb +7 -5
- data/lib/data_set/data_element.rb +2 -2
- data/lib/data_set/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 989b6c5b4029c857b0769e0a857f03f5a0e5da94
|
4
|
+
data.tar.gz: 4fb27a0570e1593773ec99f10e688c148840417c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed67d2f20782b11563772367f154110be46fb39dd17113daf018f3576f4ec24bf23fd92f7edc5ecd10498c3493351c8dad31f91b8db74f919eedac836a17038f
|
7
|
+
data.tar.gz: f2c84cefe03be53781754e0d223faccba27f776dfdb89dcd32a3c08884b494ae5f35b5b770ae0e55ebdec924a8eaaadaed2eb93ae684ed991007274f99908030
|
data/.gitignore
CHANGED
@@ -1,40 +1,49 @@
|
|
1
|
-
# Ruby
|
1
|
+
# Ruby Generated
|
2
2
|
|
3
|
+
/Gemfile.lock
|
3
4
|
/.bundle/
|
4
5
|
/.yardoc
|
5
|
-
/Gemfile.lock
|
6
6
|
/_yardoc/
|
7
|
-
|
8
|
-
# Ouput-Specific
|
9
|
-
|
10
7
|
/coverage/
|
11
8
|
/doc/
|
12
9
|
/pkg/
|
13
10
|
/spec/reports/
|
11
|
+
/spec/coverage/
|
14
12
|
/tmp/
|
15
|
-
*.log
|
16
|
-
*.tmp
|
17
|
-
*.swp
|
18
|
-
*.bak
|
19
13
|
|
20
|
-
#
|
14
|
+
# Generated Reports
|
15
|
+
reports/
|
21
16
|
|
22
|
-
|
23
|
-
.settings
|
24
|
-
.project
|
25
|
-
.classpath
|
26
|
-
*.iws
|
17
|
+
# Rspec Failure Tracking
|
27
18
|
|
28
|
-
|
19
|
+
.rspec_status
|
29
20
|
|
30
|
-
|
21
|
+
# IDE Files
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
*.
|
35
|
-
|
23
|
+
.idea/
|
24
|
+
*.iml
|
25
|
+
*.iws
|
26
|
+
*.ipr
|
27
|
+
.vscode/
|
28
|
+
.settings/
|
29
|
+
.metadata
|
30
|
+
.classpath
|
31
|
+
.loadpath
|
32
|
+
.buildpath
|
33
|
+
.project
|
36
34
|
|
37
|
-
#
|
35
|
+
# OS Files
|
38
36
|
|
39
|
-
.
|
40
|
-
.
|
37
|
+
.DS_Store
|
38
|
+
.DS_Store?
|
39
|
+
._*
|
40
|
+
.Spotlight-V100
|
41
|
+
.Trashes
|
42
|
+
ehthumbs.db
|
43
|
+
Thumbs.db
|
44
|
+
$RECYCLE.BIN/
|
45
|
+
Desktop.ini
|
46
|
+
*.tmp
|
47
|
+
*.bak
|
48
|
+
*.swp
|
49
|
+
*~.nib
|
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE.md}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# DataSet
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/data_set.svg)](http://badge.fury.io/rb/data_set)
|
4
|
-
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jeffnyman/data_set/blob/master/LICENSE.
|
5
|
-
|
6
|
-
[![Dependency Status](https://gemnasium.com/jeffnyman/data_set.png)](https://gemnasium.com/jeffnyman/data_set)
|
4
|
+
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jeffnyman/data_set/blob/master/LICENSE.md)
|
7
5
|
|
8
6
|
DataSet provides an easy mechanism to load up a set of data from a YAML file and then access that data by the structuring keys of the file. This provides an expressive way to retrieve data values.
|
9
7
|
|
@@ -15,13 +13,23 @@ To get the latest stable release, add this line to your application's Gemfile:
|
|
15
13
|
gem 'data_set'
|
16
14
|
```
|
17
15
|
|
18
|
-
|
16
|
+
To get the latest code:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'data_set', git: 'https://github.com/jeffnyman/data_set'
|
20
|
+
```
|
19
21
|
|
20
|
-
|
22
|
+
After doing one of the above, execute the following command:
|
23
|
+
|
24
|
+
```
|
25
|
+
$ bundle
|
26
|
+
```
|
21
27
|
|
22
28
|
You can also install DataSet just as you would any other gem:
|
23
29
|
|
24
|
-
|
30
|
+
```
|
31
|
+
$ gem install data_set
|
32
|
+
```
|
25
33
|
|
26
34
|
## Usage
|
27
35
|
|
@@ -118,7 +126,11 @@ This would allow the specific environment variable to be set conditionally based
|
|
118
126
|
|
119
127
|
## Development
|
120
128
|
|
121
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec:all` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
129
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec:all` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
130
|
+
|
131
|
+
The default `rake` command will run all tests as well as a RuboCop analysis.
|
132
|
+
|
133
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
122
134
|
|
123
135
|
## Contributing
|
124
136
|
|
@@ -143,4 +155,4 @@ This code is loosely based upon the [FigNewton](https://github.com/cheezy/fig_ne
|
|
143
155
|
## License
|
144
156
|
|
145
157
|
DataSet is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.
|
146
|
-
See the [LICENSE](https://github.com/jeffnyman/data_set/blob/master/LICENSE.
|
158
|
+
See the [LICENSE](https://github.com/jeffnyman/data_set/blob/master/LICENSE.md) file for details.
|
data/Rakefile
CHANGED
data/data/yaml/test_data.yml
CHANGED
data/data_set.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~>
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
spec.add_development_dependency "cucumber", "~> 3.0"
|
data/lib/data_set.rb
CHANGED
@@ -3,9 +3,9 @@ require "yaml"
|
|
3
3
|
module DataSet
|
4
4
|
module DataAccessor
|
5
5
|
def method_missing(*args, &block)
|
6
|
-
load_data_source unless @
|
6
|
+
load_data_source unless @data_contents
|
7
7
|
key = args.first
|
8
|
-
value = @
|
8
|
+
value = @data_contents[key.to_s]
|
9
9
|
value = args[1] if value.nil?
|
10
10
|
value = yield(key.to_s) if value.nil? && block
|
11
11
|
super if value.nil?
|
@@ -18,14 +18,16 @@ module DataSet
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def load_data_source
|
21
|
-
@
|
21
|
+
@data_contents = nil
|
22
22
|
path = "#{data_path}/#{ENV['DATA_SET_FILE']}"
|
23
|
+
|
23
24
|
if ENV['DATA_SET_FILE']
|
24
|
-
@
|
25
|
+
@data_contents = ::YAML.safe_load(ERB.new(
|
25
26
|
File.read(path)
|
26
27
|
).result(binding))
|
27
28
|
end
|
28
|
-
|
29
|
+
|
30
|
+
DataSet.load('default.yml') if @data_contents.nil?
|
29
31
|
end
|
30
32
|
|
31
33
|
private
|
data/lib/data_set/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Nyman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +121,7 @@ files:
|
|
121
121
|
- ".rubocop.yml"
|
122
122
|
- CODE_OF_CONDUCT.md
|
123
123
|
- Gemfile
|
124
|
-
- LICENSE.
|
124
|
+
- LICENSE.md
|
125
125
|
- README.md
|
126
126
|
- Rakefile
|
127
127
|
- bin/console
|
@@ -139,7 +139,7 @@ licenses:
|
|
139
139
|
- MIT
|
140
140
|
metadata: {}
|
141
141
|
post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
|
142
|
-
\ DataSet
|
142
|
+
\ DataSet 2.0.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::) (::) (::)
|
143
143
|
(::) (::) (::)\n "
|
144
144
|
rdoc_options: []
|
145
145
|
require_paths:
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.5.2
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Provides configuration specification and retrieval using YAML files.
|