hash_ish 0.1.0 → 0.2.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/CHANGELOG.md +4 -0
- data/README.md +7 -8
- data/lib/hash_ish/version.rb +1 -1
- data/lib/hash_ish.rb +9 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8cdf984ee41b2b0e954c4f60ebc59a31061238a
|
4
|
+
data.tar.gz: 0ff1cdea6e5b2e7a284902d319163609e882e86e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed2106fde81b31c49bbfe7e4c6315a43ca267a8ef9233ce36334e99e42e731efe6f5b89edc26069b33c26395e5111c333baa8a45235c6adf62e39b541e629e4
|
7
|
+
data.tar.gz: a0ac9a73f48fd590bd04598d36913720cbbc7115dca46721709b198646d247a523ab3c8b5c2240dbf0c51ba8cee1ea3665882527be02ed63a8e326ed00a4b664
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -14,17 +14,17 @@ gem install hash_ish
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
1. Insert hash
|
18
|
-
|
19
|
-
```
|
20
|
-
hash = { a { b: "c"} }
|
21
|
-
hash_ish = HashIsh.new(hash)
|
22
17
|
```
|
18
|
+
require 'hash_ish'
|
23
19
|
|
24
|
-
|
20
|
+
# insert hash into new hash_ish
|
21
|
+
hash = { a { b: "c" } }
|
22
|
+
hash_ish = HashIsh.new(hash)
|
25
23
|
|
26
|
-
|
24
|
+
# access hash keys with method calls
|
27
25
|
hash_ish.a.b # returns 'c'
|
26
|
+
```
|
27
|
+
|
28
28
|
|
29
29
|
## Known issues
|
30
30
|
|
@@ -41,4 +41,3 @@ HashIsh.new(123 => 456)
|
|
41
41
|
## License
|
42
42
|
|
43
43
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
44
|
-
|
data/lib/hash_ish/version.rb
CHANGED
data/lib/hash_ish.rb
CHANGED
@@ -4,16 +4,20 @@ require 'hash_ish/add_instance_methods'
|
|
4
4
|
class HashIsh
|
5
5
|
def self.new(kwargs = {})
|
6
6
|
instance(
|
7
|
-
decorate_klass(kwargs))
|
7
|
+
decorate_klass(hash_sub_class, kwargs))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.decorate_klass(klass, kwargs)
|
11
|
+
klass.tap do |klass|
|
12
|
+
AddInstanceMethods.new.add(klass, kwargs)
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
def self.instance(klass)
|
11
17
|
klass.new
|
12
18
|
end
|
13
19
|
|
14
|
-
def self.
|
15
|
-
Class.new
|
16
|
-
AddInstanceMethods.new.add(klass, kwargs)
|
17
|
-
end
|
20
|
+
def self.hash_sub_class
|
21
|
+
Class.new(Hash)
|
18
22
|
end
|
19
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_ish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Pope
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
64
|
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- CODE_OF_CONDUCT.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|