meld 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +28 -0
- data/Rakefile +14 -0
- data/lib/meld.rb +1 -0
- data/lib/meld/deep_hash_merge.rb +12 -0
- data/meld.gemspec +21 -0
- data/spec/meld_spec.rb +1 -0
- data/spec/spec_helper.rb +10 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fac5c1b8652001fe735a25c14c1b28cd67f401df
|
4
|
+
data.tar.gz: a800d28e9b6541de6398d3463b9127964b2d89c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a0632aaf890b028e16de705a8ad4eb94c35f52f3f2b76f7c5bb712238b20316610063fc2635927b4c02d1885871a5d56ef79190dd3bdeaa928187fec1142c9ca
|
7
|
+
data.tar.gz: b0cbcac640c05d0e37c1d750f73e903e412d53613cf5e5755802114ebb53df6a0b8c7ce5575855054eccfe8d4dfb3183445f320ce94e45b61ad5fc403cc245f4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Les Aker
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
meld
|
2
|
+
=========
|
3
|
+
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/meld.svg)](https://rubygems.org/gems/meld)
|
5
|
+
[![Dependency Status](https://img.shields.io/gemnasium/akerl/meld.svg)](https://gemnasium.com/akerl/meld)
|
6
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/akerl/meld.svg)](https://codeclimate.com/github/akerl/meld)
|
7
|
+
[![Coverage Status](https://img.shields.io/coveralls/akerl/meld.svg)](https://coveralls.io/r/akerl/meld)
|
8
|
+
[![Build Status](https://img.shields.io/travis/akerl/meld.svg)](https://travis-ci.org/akerl/meld)
|
9
|
+
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
|
10
|
+
|
11
|
+
Utility library for combining objects
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Deep hash merge -- .deep_merge
|
16
|
+
|
17
|
+
This will merge nested hashes
|
18
|
+
|
19
|
+
Credit for the method goes to [this StackOverflow answer](http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash)
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
gem install meld
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
meld is released under the MIT License. See the bundled LICENSE file for details.
|
28
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
desc 'Run tests'
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
desc 'Run Rubocop on the gem'
|
9
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
10
|
+
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
11
|
+
task.fail_on_error = true
|
12
|
+
end
|
13
|
+
|
14
|
+
task default: [:spec, :rubocop, :build, :install]
|
data/lib/meld.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'meld/deep_hash_merge'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Kernel
|
2
|
+
# From https://gist.github.com/ku/e17e3d65ec4c37b60149
|
3
|
+
# From http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash
|
4
|
+
class Hash
|
5
|
+
def deep_merge(second)
|
6
|
+
merger = proc do |_, v1, v2|
|
7
|
+
[v1, v2].all? { |x| x.is_a? Hash } ? v1.merge(v2, &merger) : v2
|
8
|
+
end
|
9
|
+
merge(second, &merger)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/meld.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'meld'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = Time.now.strftime("%Y-%m-%d")
|
5
|
+
|
6
|
+
s.summary = 'Utility library for combining objects'
|
7
|
+
s.description = "Utility library for combining objects"
|
8
|
+
s.authors = ['Les Aker']
|
9
|
+
s.email = 'me@lesaker.org'
|
10
|
+
s.homepage = 'https://github.com/akerl/meld'
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split
|
14
|
+
s.test_files = `git ls-files spec/*`.split
|
15
|
+
|
16
|
+
s.add_development_dependency 'rubocop', '~> 0.26.0'
|
17
|
+
s.add_development_dependency 'rake', '~> 10.3.2'
|
18
|
+
s.add_development_dependency 'coveralls', '~> 0.7.1'
|
19
|
+
s.add_development_dependency 'rspec', '~> 3.1.0'
|
20
|
+
s.add_development_dependency 'fuubar', '~> 2.0.0'
|
21
|
+
end
|
data/spec/meld_spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'spec_helper'
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: meld
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Les Aker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.26.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.26.0
|
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.3.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 10.3.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: fuubar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.0
|
83
|
+
description: Utility library for combining objects
|
84
|
+
email: me@lesaker.org
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- ".gitignore"
|
90
|
+
- ".rspec"
|
91
|
+
- ".rubocop.yml"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- lib/meld.rb
|
98
|
+
- lib/meld/deep_hash_merge.rb
|
99
|
+
- meld.gemspec
|
100
|
+
- spec/meld_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
homepage: https://github.com/akerl/meld
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.2.2
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Utility library for combining objects
|
126
|
+
test_files:
|
127
|
+
- spec/meld_spec.rb
|
128
|
+
- spec/spec_helper.rb
|