hash-to-obj 0.2.0 → 0.3.0
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 +4 -4
- data/LICENSE +23 -0
- data/hash-to-obj.gemspec +1 -0
- data/lib/hash-to-obj.rb +1 -0
- data/lib/hash-to-obj/default_module.rb +14 -0
- data/lib/hash-to-obj/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22189599e11ddacb42d4eaef80ca2b1d00ca80b
|
4
|
+
data.tar.gz: d1c44150dd4816abc90d5c5d4dac59ead133c68b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35c63268f4c5dc63bb86b50d895f3a30734c5d3e53dd664c5d644bd5e77666e905ce39b47cac865c4aecdbbd741f8279a42f34047d17ae2bda4e7e4333f7b495
|
7
|
+
data.tar.gz: 5c8918c57f77ba6f48b84364e128ae89e61fe5839839e2ddd1a94ee31c7441577a3ba040385b8de320b893c9681f03ab51c6f92900de4264c6b2ef46b9375a0f
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
2
|
+
this software and associated documentation files (the "Software"), to deal in
|
3
|
+
the Software without restriction, including without limitation the rights to
|
4
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
5
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
6
|
+
subject to the following conditions:
|
7
|
+
The above copyright notice and this permission notice shall be included in all
|
8
|
+
copies or substantial portions of the Software.
|
9
|
+
|
10
|
+
Distributions of all or part of the Software intended to be used by the
|
11
|
+
recipients as they would use the unmodified Software, containing modifications
|
12
|
+
that substantially alter, remove, or disable functionality of the Software,
|
13
|
+
outside of the documented configuration mechanisms provided by the Software,
|
14
|
+
shall be modified such that the Original Author's bug reporting email addresses
|
15
|
+
and urls are either replaced with the contact information of the parties
|
16
|
+
responsible for the changes, or removed entirely.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
20
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
21
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
22
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
23
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/hash-to-obj.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = HashToObj::VERSION
|
9
9
|
spec.authors = ['Sam Maxwell']
|
10
10
|
spec.email = ['raindropenter@gmail.com']
|
11
|
+
spec.license = 'MITNFA'
|
11
12
|
|
12
13
|
spec.summary = 'Simple Ruby gem to objectify hashes'
|
13
14
|
spec.description = "Call 'objectify my_hash' to add accessor methods to "\
|
data/lib/hash-to-obj.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
module HashToObj
|
2
|
+
##
|
3
|
+
# Extend this for a small DSL around creating default methods.
|
4
|
+
module DefaultModule
|
5
|
+
##
|
6
|
+
# Defines a method that simulates a defaulted key in the hash. If the key is
|
7
|
+
# added to the hash later, this will correctly pick up on that. You can
|
8
|
+
# specify a default value as well. This value is NOT copied.
|
9
|
+
def default_key(key, value=nil)
|
10
|
+
define_method(key) { self.has_key?(key) ? self[key] : value }
|
11
|
+
define_method("#{key}=") { |new_value| self[key] = new_value}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/hash-to-obj/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash-to-obj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Maxwell
|
@@ -78,14 +78,17 @@ files:
|
|
78
78
|
- ".rspec"
|
79
79
|
- ".travis.yml"
|
80
80
|
- Gemfile
|
81
|
+
- LICENSE
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
83
84
|
- bin/setup
|
84
85
|
- hash-to-obj.gemspec
|
85
86
|
- lib/hash-to-obj.rb
|
87
|
+
- lib/hash-to-obj/default_module.rb
|
86
88
|
- lib/hash-to-obj/version.rb
|
87
89
|
homepage: https://github.com/ReinAkane/hash-to-obj
|
88
|
-
licenses:
|
90
|
+
licenses:
|
91
|
+
- MITNFA
|
89
92
|
metadata: {}
|
90
93
|
post_install_message:
|
91
94
|
rdoc_options: []
|