storable 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +3 -1
- data/lib/storable.rb +11 -8
- data/storable.gemspec +1 -14
- metadata +5 -14
data/CHANGES.txt
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
STORABLE, CHANGES
|
2
2
|
|
3
|
+
#### 0.5.4 (2009-05-25) #############################
|
4
|
+
|
5
|
+
* CHANGE: Removed RedCloth dependency from gemspec.
|
3
6
|
|
4
7
|
#### 0.5.3 (2009-05-12) #############################
|
5
8
|
|
6
9
|
* FIXED: Corrected error handling when json not available (ignore and continue)
|
7
10
|
|
8
|
-
|
9
11
|
#### 0.5.2 (2009-05-12) #############################
|
10
12
|
|
11
13
|
* CHANGE: Put OrderedHash into Storable namespace and imported merge fix from Caesars
|
data/lib/storable.rb
CHANGED
@@ -22,7 +22,7 @@ require 'fileutils'
|
|
22
22
|
class Storable
|
23
23
|
require 'storable/orderedhash' if USE_ORDERED_HASH
|
24
24
|
unless defined?(SUPPORTED_FORMATS) # We can assume all are defined
|
25
|
-
VERSION = 0.5
|
25
|
+
VERSION = "0.5.4"
|
26
26
|
NICE_TIME_FORMAT = "%Y-%m-%d@%H:%M:%S".freeze
|
27
27
|
SUPPORTED_FORMATS = [:tsv, :csv, :yaml, :json, :s, :string].freeze
|
28
28
|
end
|
@@ -125,13 +125,17 @@ class Storable
|
|
125
125
|
def self.from_hash(from={})
|
126
126
|
return nil if !from || from.empty?
|
127
127
|
me = self.new
|
128
|
-
|
128
|
+
me.from_hash(from)
|
129
|
+
end
|
130
|
+
|
131
|
+
def from_hash(from={})
|
129
132
|
fnames = field_names
|
130
133
|
fnames.each_with_index do |key,index|
|
131
134
|
|
132
135
|
stored_value = from[key] || from[key.to_s] # support for symbol keys and string keys
|
133
136
|
|
134
|
-
# TODO: Correct this horrible implementation
|
137
|
+
# TODO: Correct this horrible implementation
|
138
|
+
# (sorry, me. It's just one of those days.) -- circa 2009-09-15
|
135
139
|
|
136
140
|
if field_types[index] == Array
|
137
141
|
((value ||= []) << stored_value).flatten
|
@@ -162,12 +166,11 @@ class Storable
|
|
162
166
|
end
|
163
167
|
end
|
164
168
|
|
165
|
-
|
169
|
+
self.send("#{key}=", value) if self.respond_to?("#{key}=")
|
166
170
|
end
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
me
|
171
|
+
|
172
|
+
self.postprocess
|
173
|
+
self
|
171
174
|
end
|
172
175
|
# Return the object data as a hash
|
173
176
|
# +with_titles+ is ignored.
|
data/storable.gemspec
CHANGED
@@ -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.5.
|
4
|
+
s.version = "0.5.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"
|
@@ -39,17 +39,4 @@
|
|
39
39
|
s.require_paths = %w[lib]
|
40
40
|
s.rubygems_version = '1.3.0'
|
41
41
|
|
42
|
-
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version = 2
|
45
|
-
|
46
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<RedCloth>, [">= 4.0.4"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
|
50
|
-
end
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
|
53
|
-
end
|
54
|
-
|
55
42
|
end
|
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.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,19 +9,10 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-25 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: RedCloth
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 4.0.4
|
24
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
25
16
|
description: "Storable: Marshal Ruby classes into and out of multiple formats (yaml, json, csv, tsv)"
|
26
17
|
email: delano@solutious.com
|
27
18
|
executables: []
|
@@ -69,7 +60,7 @@ requirements: []
|
|
69
60
|
rubyforge_project: storable
|
70
61
|
rubygems_version: 1.3.2
|
71
62
|
signing_key:
|
72
|
-
specification_version:
|
63
|
+
specification_version: 3
|
73
64
|
summary: "Storable: Marshal Ruby classes into and out of multiple formats (yaml, json, csv, tsv)"
|
74
65
|
test_files: []
|
75
66
|
|