structure 0.28.3 → 0.28.4

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/structure.rb +12 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d880d2f652bb1b6d883a586f69079f76803fb66b
4
- data.tar.gz: cac8fb4496f4fc1980b3cacb3a138dbb1a2a0528
3
+ metadata.gz: d77e0416536e453a05108b31134fd24008e49f0e
4
+ data.tar.gz: e2122d7456a18be5adbef05cf999cc0b435f1e7a
5
5
  SHA512:
6
- metadata.gz: 55849fa9ee47d40adb5c0659cdec68e21276e7609ec8b2c09a3819eafbc2345c6ca65c30dcfcfbf617c8e61199c345a7a981d556cf13a00e807c3bcbcbe25aa0
7
- data.tar.gz: 12c3f3e2f1196a01be5cfb040e973a5f683e5c138fe9bc53e6b907d5d449d17769fd47f2420ef278c30a3d75905577e1f5855f261d0f539b6a0321bd96906fc4
6
+ metadata.gz: d5ced1b086d058b3959b87c4be06e0b3e71634c91beb10806bacb14d02ff956a532b0d1c42bb5915d601ac8b1865c6b0d7be6184a0d8491f02b8ef4ac52de56e
7
+ data.tar.gz: 8085732ad84ef408c32eda27c35e4cadd25a11aaf919593cb93b26508ef91cb2efcf3f57ff1c22088b48735b89b715965644c22d53e3e88cec5c7ab001dab8fe
data/structure.rb CHANGED
@@ -4,8 +4,18 @@ module Structure
4
4
  end
5
5
 
6
6
  def attributes
7
- attribute_names.reduce({}) { |ret, name|
8
- ret.update(name => self.send(name))
7
+ attribute_names.reduce({}) { |ret, key|
8
+ val = self.send(key)
9
+
10
+ ret.update(key =>
11
+ if val.respond_to?(:attributes)
12
+ val.attributes
13
+ elsif val.is_a?(Array)
14
+ val.map { |el| el.respond_to?(:attributes) ? el.attributes : el }
15
+ else
16
+ val
17
+ end
18
+ )
9
19
  }
10
20
  end
11
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.3
4
+ version: 0.28.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-24 00:00:00.000000000 Z
11
+ date: 2014-07-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: me@hakanensari.com