storable 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  STORABLE, CHANGES
2
2
 
3
+ #### 0.6.1 (2010-01-15) #############################
4
+
5
+ * ADDED: Default initialize for Storable objects which can set field values.
6
+
3
7
  #### 0.6.0 (2009-11-27) #############################
4
8
 
5
9
  * FIXED: Undefined @@field_names error when no fields specified
@@ -1,4 +1,4 @@
1
- = Storable - v0.5
1
+ = Storable - v0.6
2
2
 
3
3
  Marshal Ruby classes into and out of multiple formats (yaml, json, csv, tsv)
4
4
 
@@ -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.0"
43
+ VERSION = "0.6.1"
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
@@ -107,6 +107,14 @@ class Storable
107
107
  self.class.field_names.member? n.to_sym
108
108
  end
109
109
 
110
+ # +args+ is a list of values to set amongst the fields.
111
+ # It's assumed that the order values matches the order
112
+ def initialize(*args)
113
+ (self.class.field_names || []).each_with_index do |n,index|
114
+ break if (index+1) >= args.size
115
+ self.send("#{n}=", args[index])
116
+ end
117
+ end
110
118
 
111
119
  # Returns an array of field names defined by self.field
112
120
  def field_names
@@ -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.0"
4
+ s.version = "0.6.1"
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.0
4
+ version: 0.6.1
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: 2009-11-27 00:00:00 -05:00
12
+ date: 2010-01-15 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15