hashable 0.1.1 → 0.1.2
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.
- data/lib/hashable.rb +2 -1
- data/lib/hashable/array.rb +16 -0
- data/lib/hashable/hash.rb +1 -1
- data/lib/hashable/version.rb +1 -1
- metadata +2 -1
data/lib/hashable.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/hashable'
|
2
|
+
|
3
|
+
class Array
|
4
|
+
include Hashable
|
5
|
+
# Return recursively hash representation of the given array
|
6
|
+
#
|
7
|
+
# @return array
|
8
|
+
def to_deep_hash
|
9
|
+
new_array = []
|
10
|
+
self.each_index do |index|
|
11
|
+
new_array[index] = deeply_to_hash(self[index])
|
12
|
+
end
|
13
|
+
new_array
|
14
|
+
end
|
15
|
+
alias_method :to_dh, :to_deep_hash
|
16
|
+
end
|
data/lib/hashable/hash.rb
CHANGED
data/lib/hashable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- Rakefile
|
59
59
|
- hashable.gemspec
|
60
60
|
- lib/hashable.rb
|
61
|
+
- lib/hashable/array.rb
|
61
62
|
- lib/hashable/hash.rb
|
62
63
|
- lib/hashable/hashable.rb
|
63
64
|
- lib/hashable/version.rb
|