to_dots 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/array.rb +1 -1
- data/lib/hash.rb +1 -1
- data/lib/to_dots/version.rb +1 -1
- data/lib/to_dots.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a8988e3d224fac93c0498c0b32d3024fd431e90
|
4
|
+
data.tar.gz: 2883d756770d337e2b6a2396907e066a0fd1494b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9695194cc507d4986acd6a0f5798b1541b812698b8468c435abb861335f1a3e0653a7ed880d4b9ddc88f97c6f164edfdf8e5301ff119a3b26ebc80b021bd1359
|
7
|
+
data.tar.gz: 29b47fc10b965317962dc4ddb93cc8e2d43b47923629bb5135ad245d907557e500e95468f0afefd790e3ebe418167dc6bdcfe11d697af0a8bc806ec7428476ec
|
data/.gitignore
CHANGED
data/lib/array.rb
CHANGED
data/lib/hash.rb
CHANGED
data/lib/to_dots/version.rb
CHANGED
data/lib/to_dots.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require "to_dots/version"
|
2
|
+
require 'hash'
|
3
|
+
require 'array'
|
2
4
|
|
3
5
|
module ToDots
|
4
6
|
def self.to_dots(object, result = [], prefix = '')
|
5
7
|
case object
|
6
|
-
when Hash
|
8
|
+
when ::Hash
|
7
9
|
object.each do |key, value|
|
8
10
|
to_dots(value, result, "#{prefix}#{'.' unless prefix.empty?}#{key}")
|
9
11
|
end
|
10
|
-
when Array
|
12
|
+
when ::Array
|
11
13
|
object.each_with_index do |value, index|
|
12
14
|
to_dots(value, result, "#{prefix}")
|
13
15
|
end
|