storable 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES.txt +7 -0
  2. data/lib/storable.rb +3 -7
  3. data/storable.gemspec +1 -1
  4. metadata +2 -2
@@ -1,5 +1,12 @@
1
1
  STORABLE, CHANGES
2
2
 
3
+ * TODO: field_types and field_names go out of order when defining some fields with types and others not. The quick fix is to define fields with no type at the end
4
+
5
+ #### 0.6.4 (2010-03-10) #############################
6
+
7
+ * FIXED: Don't pull the first value out of an array if there is only one element.
8
+ * FIXED: Stored Arrays were nested in another Array in some cases
9
+
3
10
  #### 0.6.2 (2010-02-12) #############################
4
11
 
5
12
  * CHANGE: Removed hanna dependency [Diego Elio 'Flameeyes' Pettenò]
@@ -40,7 +40,7 @@ class Storable
40
40
 
41
41
  require 'storable/orderedhash' if USE_ORDERED_HASH
42
42
  unless defined?(SUPPORTED_FORMATS) # We can assume all are defined
43
- VERSION = "0.6.3"
43
+ VERSION = "0.6.4"
44
44
  NICE_TIME_FORMAT = "%Y-%m-%d@%H:%M:%S".freeze
45
45
  SUPPORTED_FORMATS = [:tsv, :csv, :yaml, :json, :s, :string].freeze
46
46
  end
@@ -166,22 +166,18 @@ class Storable
166
166
  def from_hash(from={})
167
167
  fnames = field_names
168
168
  fnames.each_with_index do |key,index|
169
-
170
169
  stored_value = from[key] || from[key.to_s] # support for symbol keys and string keys
171
170
 
172
171
  # TODO: Correct this horrible implementation
173
172
  # (sorry, me. It's just one of those days.) -- circa 2008-09-15
174
173
 
175
174
  if field_types[index] == Array
176
- ((value ||= []) << stored_value).flatten
175
+ value = Array === stored_value ? stored_value : [stored_value]
177
176
  elsif field_types[index].kind_of?(Hash)
178
-
179
177
  value = stored_value
180
178
  else
181
179
 
182
- # SimpleDB stores attribute shit as lists of values
183
- ##value = stored_value.first if stored_value.is_a?(Array) && stored_value.size == 1
184
- value = (stored_value.is_a?(Array) && stored_value.size == 1) ? stored_value.first : stored_value
180
+ value = stored_value
185
181
 
186
182
  if field_types[index] == Time
187
183
  value = Time.parse(value)
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "storable"
3
3
  s.rubyforge_project = "storable"
4
- s.version = "0.6.3"
4
+ s.version = "0.6.4"
5
5
  s.summary = "Storable: Marshal Ruby classes into and out of multiple formats (yaml, json, csv, tsv)"
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-20 00:00:00 -05:00
12
+ date: 2010-03-15 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15