middleman-dato 0.0.1.rc1 → 0.0.1.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed9565a5d3246be461c39df52db283447c82ef46
4
- data.tar.gz: 20d797f3c0f3af1a314748be70f640d875001608
3
+ metadata.gz: 2662bb3c2b38f4f37124b6ea9eb18de9db52b121
4
+ data.tar.gz: f798ff90cad69d1eb951dc3d95d345d9bc9b30a7
5
5
  SHA512:
6
- metadata.gz: 95f56a75ae771fe6815c033339baeeb5d54be9905159f615b4efc7cdc51b4464ba0404a8f18910202b4903d3bf2850743f3f153ddfd76dccd51228ceffa77fe1
7
- data.tar.gz: e8e6431de61cc373adfdd3874af67d8129892066db65522d264bd2cd4d2781b44e576f0bd08d8aa832eed8cfbebb235081fffda6403f1add0d781ab5b8890981
6
+ metadata.gz: 935e93b6a99c6c7a244b7f48184f3af845f8252d04cf696d8a94c00971fbd8e1a5c906ead27407ca39e0fedc2a4ed91a6888e22d1f046e734d02de9bdbf41895
7
+ data.tar.gz: 88393186cced3a657979a04fefafb21a482791dbfb4a5f060935f8c10d7286b9d43d7af4f45006729e79bb9617a2d511436da953e8cac65f00587d945cd5dedb
data/lib/dato/repo.rb CHANGED
@@ -66,18 +66,19 @@ module Dato
66
66
 
67
67
  def group_by_content_type(data)
68
68
  Hash[
69
- data
70
- .with_indifferent_access[:data]
71
- .group_by do |record|
72
- record[:links][:content_type][:linkage][:id]
73
- end
74
- .map do |content_type, records|
75
- if content_types[content_type][:singleton]
76
- [ content_type, normalize_record(records.first) ]
77
- else
78
- [ content_type.pluralize, group_by_id(records) ]
69
+ content_types.map do |id, content_type|
70
+ records = data
71
+ .with_indifferent_access[:data]
72
+ .select do |record|
73
+ record[:links][:content_type][:linkage][:id] == id
79
74
  end
75
+
76
+ if content_type[:singleton]
77
+ [ id, records.any? ? normalize_record(records.first) : nil ]
78
+ else
79
+ [ id.pluralize, group_by_id(records) ]
80
80
  end
81
+ end
81
82
  ]
82
83
  end
83
84
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "middleman-dato"
6
- s.version = "0.0.1.rc1"
6
+ s.version = "0.0.1.rc2"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Stefano Verna"]
9
9
  s.email = ["s.verna@cantierecreativo.net"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc1
4
+ version: 0.0.1.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-24 00:00:00.000000000 Z
11
+ date: 2015-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core