raze 0.0.0 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raze.rb +7 -5
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ca85fc02d85949160d5d19debcf493cea4f635
|
4
|
+
data.tar.gz: d2cc83ff98d6edad89aa574ff3c2fd90d9140151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6c5315b352cd2f2bac42f9f4b5d9cd5cbcf2b644979fe49af7127ad13dacdbe569a7e333662808a5d12f63e73d4cfee03d820965cf27c74a14c3403b2fd2333
|
7
|
+
data.tar.gz: c72d01c03ccbed254d3d6db49a064cf694978628b3643a2bb05503dee4edf75f6d054bbfed1e09cb394697430202fc0ad7025b4c3cb4eeeab1bc71dbe915eb6b
|
data/lib/raze.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# main module of raze
|
2
|
-
|
3
|
-
def flatten(collection)
|
2
|
+
class Raze
|
3
|
+
def self.flatten(collection)
|
4
4
|
if collection.class == Hash
|
5
|
-
|
5
|
+
flatten(collection.flatten)
|
6
6
|
elsif collection.class == Array
|
7
|
-
|
7
|
+
collection.map do |child|
|
8
|
+
flatten(child)
|
9
|
+
end.flatten
|
8
10
|
else
|
9
|
-
|
11
|
+
collection
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austen Madden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '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'
|
13
27
|
description: |2
|
14
28
|
Provides methods to flatten nested collections into
|
15
29
|
one dimensional structure that is easy to iterate over.
|