storable 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -3,6 +3,12 @@ STORABLE, CHANGES
3
3
  * TODO: Handle nested hashes and arrays.
4
4
  * TODO: to_xml, see: http://codeforpeople.com/lib/ruby/xx/xx-2.0.0/README
5
5
 
6
+ #### 0.7.4 (2010-05-01) #############################
7
+
8
+ * FIXED: Check separately if getter and setter methods are already defined
9
+ * ADDED: Call Storable#preprocessor after an object is initialized
10
+
11
+
6
12
  #### 0.7.3 (2010-04-10) #############################
7
13
 
8
14
  * ADDED: Allow anonymous objects via Storable.from_json etc.
data/README.rdoc CHANGED
@@ -70,15 +70,21 @@ or via download:
70
70
  * Ruby 1.8, Ruby 1.9, or JRuby 1.2+
71
71
 
72
72
 
73
+ == Credits
74
+
75
+ * Delano Mandelbaum (delano@solutious.com)
76
+ * lib/proc_source.rb is based on http://github.com/imedo/background
77
+ * OrderedHash implementation by Jan Molic
78
+
79
+
73
80
  == Thanks
74
81
 
75
82
  * Pierre Riteau (priteau[http://github.com/priteau]) for bug fixes.
76
83
 
77
84
 
78
- == Credits
85
+ == More Info
79
86
 
80
- * Delano Mandelbaum (delano@solutious.com)
81
- * OrderedHash implementation by Jan Molic
87
+ * Codes[http://github.com/delano/storable]
82
88
 
83
89
  == License
84
90
 
data/lib/storable.rb CHANGED
@@ -39,7 +39,7 @@ class Storable
39
39
  require 'proc_source'
40
40
  require 'storable/orderedhash' if USE_ORDERED_HASH
41
41
  unless defined?(SUPPORTED_FORMATS) # We can assume all are defined
42
- VERSION = "0.7.3"
42
+ VERSION = "0.7.4"
43
43
  NICE_TIME_FORMAT = "%Y-%m-%d@%H:%M:%S".freeze
44
44
  SUPPORTED_FORMATS = [:tsv, :csv, :yaml, :json, :s, :string].freeze
45
45
  end
@@ -95,16 +95,20 @@ class Storable
95
95
  define_method("_storable_processor_#{m}", &processor)
96
96
  end
97
97
 
98
- if method_defined?(m) # don't redefine the accessor methods
98
+ if method_defined?(m) # don't redefine the getter method
99
99
  STDERR.puts "method exists: #{self}##{m}" if Storable.debug
100
- next
100
+ else
101
+ define_method(m) do
102
+ instance_variable_get("@#{m}")
103
+ end
101
104
  end
102
105
 
103
- define_method(m) do
104
- instance_variable_get("@#{m}")
105
- end
106
- define_method("#{m}=") do |val|
107
- instance_variable_set("@#{m}",val)
106
+ if method_defined?("#{m}=") # don't redefine the setter methods
107
+ STDERR.puts "method exists: #{self}##{m}=" if Storable.debug
108
+ else
109
+ define_method("#{m}=") do |val|
110
+ instance_variable_set("@#{m}",val)
111
+ end
108
112
  end
109
113
  end
110
114
  end
@@ -123,6 +127,7 @@ class Storable
123
127
  break if (index+1) > args.size
124
128
  self.send("#{n}=", args[index])
125
129
  end
130
+ preprocess if respond_to?(:preprocess)
126
131
  end
127
132
 
128
133
  # Returns an array of field names defined by self.field
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.7.3"
4
+ s.version = "0.7.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.7.3
4
+ version: 0.7.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-04-11 00:00:00 -04:00
12
+ date: 2010-05-01 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15