raze 0.0.0 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/raze.rb +7 -5
  3. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c70171bd4c2e306bd45596597779c8110955d57e
4
- data.tar.gz: f6d78f9ab4b5fba503ac0858cbba5b5590ff2f47
3
+ metadata.gz: 23ca85fc02d85949160d5d19debcf493cea4f635
4
+ data.tar.gz: d2cc83ff98d6edad89aa574ff3c2fd90d9140151
5
5
  SHA512:
6
- metadata.gz: 40d0938fad55cdb99d1d05742e977a1255ef7242e7097a2e0cf2f81826e55ade95a92044a9fe4a0063b614a37aae61bf29997ff95252c05f536d7a99466f03bb
7
- data.tar.gz: c89e725afb8f221d22812e5ebb73b5748e9dea14161ae39adb11578554cd22cfbf43845dc401db8089c4a6073dc3122e0c6fa33d251fa730656a681b2eedb58f
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
- module Raze
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.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: 2015-02-09 00:00:00.000000000 Z
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.