cluster 0.7.11 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cluster/infrastructures/amazon.rb +21 -6
- data/lib/cluster/version.rb +1 -1
- metadata +2 -2
@@ -580,15 +580,29 @@ class Amazon < Infrastructure
|
|
580
580
|
end
|
581
581
|
end
|
582
582
|
|
583
|
+
EMPTY_ARRAY_ELEMENT = 'sdb_empty_array_element_&:&#!-'
|
583
584
|
class << self
|
584
585
|
def to_sdb_attributes(args)
|
585
586
|
attrs = {}
|
586
|
-
# FIXME this needs a way to deal with arrays that are empty
|
587
587
|
args.each do |k, v|
|
588
|
-
|
589
|
-
|
590
|
-
v =
|
591
|
-
|
588
|
+
next unless v
|
589
|
+
|
590
|
+
v = if Array === v and v.empty?
|
591
|
+
# We store an empty array as an array with the single specialized element
|
592
|
+
[self::EMPTY_ARRAY_ELEMENT]
|
593
|
+
|
594
|
+
elsif Time === v
|
595
|
+
# FIXME we probably should have some extra indicator of a
|
596
|
+
# time field so that we can unmarshal it in the #from_sdb_results
|
597
|
+
[v.utc.httpdate]
|
598
|
+
|
599
|
+
elsif Date === v
|
600
|
+
[v.to_time.utc.httpdate]
|
601
|
+
|
602
|
+
else
|
603
|
+
Array(v)
|
604
|
+
end
|
605
|
+
attrs.merge!(k => v)
|
592
606
|
end
|
593
607
|
attrs
|
594
608
|
end
|
@@ -613,7 +627,8 @@ class Amazon < Infrastructure
|
|
613
627
|
v = if v.empty?
|
614
628
|
nil
|
615
629
|
elsif v.length == 1
|
616
|
-
v.first
|
630
|
+
ff = v.first
|
631
|
+
ff.eql?(self::EMPTY_ARRAY_ELEMENT) ? [] : ff
|
617
632
|
else
|
618
633
|
v
|
619
634
|
end
|
data/lib/cluster/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuidtools
|