polyblock 0.4.6 → 0.4.7

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: 42747cfbd46df2c15e5ca45e18e30b2892f3812f
4
- data.tar.gz: 11830645c53a9f3b99ecdba1ae1c6df39d968aea
3
+ metadata.gz: 05240a5a962e2ad7b6c0172c48ff0c1796de1990
4
+ data.tar.gz: ee083552560a4635714fb333bb397aae5a5700f3
5
5
  SHA512:
6
- metadata.gz: 5e22778c2477ba6f63847a81482c9441f6da11e40a86a29e54ab6752c6fb361cf5d60e3251c17028b807e2a201f3c488eea49e46cebe06f13c00142af38ededb
7
- data.tar.gz: a7cc3b2e8dde9476a6edb9a339e952654f8b751a58b5341b5a5a12df9adac06d2db5e01a0e5c2f1022a620fb5fba09f33c625e652107c97a0cd07bfc6991a3fb
6
+ metadata.gz: d2e6861b9cf59615cc45dcfa0e296decfd70cb30f7769d9d83db134e18bcd78caf99769498b8186503cb1e3e8523cc4325c71db0a4b32ca253be9ecdf87b17f2
7
+ data.tar.gz: 013fd350f4bcfe098898664e39b9012ba541445c40632ae767ece8d8da35f5dd0912d1601c752a9603e075294d2e8fb7e5214a405cd73e8bd6f33c0a382a699f
@@ -6,7 +6,16 @@ module Polyblock
6
6
  belongs_to :contentable, :polymorphic => true, :dependent => :destroy
7
7
 
8
8
  def self.import(pbs)
9
- pbs.each{|pb| Block.create(pb) }
9
+ outputs = pbs.map do |pb|
10
+ matches = Block.where :name => pb[:name]
11
+ if matches.any?
12
+ m = matches.first
13
+ m.update_attributes(pb) if m.content != pb[:content]
14
+ else
15
+ Block.create(pb)
16
+ end
17
+ end
18
+ outputs.include?(false)
10
19
  end
11
20
 
12
21
  def self.export
@@ -1,3 +1,3 @@
1
1
  module Polyblock
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith