hash_easy 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +3 -0
- data/hash_easy.gemspec +24 -0
- data/lib/hash_easy/bottomless_hash.rb +15 -0
- data/lib/hash_easy/version.rb +3 -0
- data/lib/hash_easy.rb +5 -0
- data/spec/hash_easy/bottomless_hash_spec.rb +49 -0
- data/spec/hash_easy/hash_easy_spec.rb +4 -0
- data/spec/spec_helper.rb +9 -0
- data/tasks/rspec.rake +3 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36563977fec707de5a9801bc19230f2c25e7323a
|
4
|
+
data.tar.gz: 34a00eed7943e812323df47fdf84427cdbd5701e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e9a531ff58d3c8b676cb260e9f2d70cc93d88b9f91c7b602b3612cad2b7c3e35dcda7a5da552c5584dd7a2b1f2c84e3e6773ec7598231ffae475f66918f2363e
|
7
|
+
data.tar.gz: 1df9db66ca97d8e66fa579a1b259fdce462971044a3f5bd8436d85aab3e1abd94384cf31a81d5fab71bba04b7527269e8808cb70c9f5d29c3a26dfed1a00c846
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hash_easy (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
rake (10.4.2)
|
11
|
+
rspec (3.3.0)
|
12
|
+
rspec-core (~> 3.3.0)
|
13
|
+
rspec-expectations (~> 3.3.0)
|
14
|
+
rspec-mocks (~> 3.3.0)
|
15
|
+
rspec-core (3.3.2)
|
16
|
+
rspec-support (~> 3.3.0)
|
17
|
+
rspec-expectations (3.3.1)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.3.0)
|
20
|
+
rspec-mocks (3.3.2)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.3.0)
|
23
|
+
rspec-support (3.3.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.7)
|
30
|
+
hash_easy!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Thiago da Anunciação
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# HashEasy
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'hash_easy'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install hash_easy
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/hash_easy/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/hash_easy.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hash_easy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "hash_easy"
|
8
|
+
spec.version = HashEasy::VERSION
|
9
|
+
spec.authors = ["Thiago da Anunciação"]
|
10
|
+
spec.email = ["thiago.anunciacao@me.com"]
|
11
|
+
spec.summary = %q{Some good methods to help you with your hashies.}
|
12
|
+
spec.description = %q{Forget of start your hashes which makes your code dirty and annoying to test.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
data/lib/hash_easy.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BottomlessHash do
|
4
|
+
subject { described_class.new }
|
5
|
+
|
6
|
+
it 'does not raise on missing key' do
|
7
|
+
expect do
|
8
|
+
subject[:missing][:key]
|
9
|
+
end.to_not raise_error
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns an empty value on missing key' do
|
13
|
+
expect(subject[:missing][:key]).to be_empty
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'stores and returns keys' do
|
17
|
+
subject[:existing][:key] = :value
|
18
|
+
expect(subject[:existing][:key]).to eq :value
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#from_hash' do
|
22
|
+
let (:hash) do
|
23
|
+
{ existing: { key: { value: :hello } } }
|
24
|
+
end
|
25
|
+
|
26
|
+
subject do
|
27
|
+
described_class.from_hash(hash)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns old hash values' do
|
31
|
+
expect(subject[:existing][:key][:value]).to eq :hello
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'provides a bottomless version' do
|
35
|
+
expect(subject[:missing][:key]).to be_empty
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'stores and returns new values' do
|
39
|
+
subject[:existing][:key] = :value
|
40
|
+
expect(subject[:existing][:key]).to eq :value
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'converts nested hashes as well' do
|
44
|
+
expect do
|
45
|
+
subject[:existing][:key][:missing]
|
46
|
+
end.to_not raise_error
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/tasks/rspec.rake
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hash_easy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thiago da Anunciação
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Forget of start your hashes which makes your code dirty and annoying
|
56
|
+
to test.
|
57
|
+
email:
|
58
|
+
- thiago.anunciacao@me.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- hash_easy.gemspec
|
70
|
+
- lib/hash_easy.rb
|
71
|
+
- lib/hash_easy/bottomless_hash.rb
|
72
|
+
- lib/hash_easy/version.rb
|
73
|
+
- spec/hash_easy/bottomless_hash_spec.rb
|
74
|
+
- spec/hash_easy/hash_easy_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- tasks/rspec.rake
|
77
|
+
homepage: ''
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.4.5.1
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Some good methods to help you with your hashies.
|
101
|
+
test_files:
|
102
|
+
- spec/hash_easy/bottomless_hash_spec.rb
|
103
|
+
- spec/hash_easy/hash_easy_spec.rb
|
104
|
+
- spec/spec_helper.rb
|