populator 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.2.5 (October 1st, 2008)
2
+
3
+ * compatibility with RubyGems 1.3
4
+
5
+ * mass assign attributes with "attributes=" method
6
+
1
7
  0.2.4 (September 9th, 2008)
2
8
 
3
9
  * removing echoe from gem development dependencies, which didn't seem to work in the first place.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('populator', '0.2.4') do |p|
5
+ Echoe.new('populator', '0.2.5') do |p|
6
6
  p.summary = "Mass populate an Active Record database."
7
7
  p.description = "Mass populate an Active Record database."
8
8
  p.url = "http://github.com/ryanb/populator"
@@ -43,6 +43,13 @@ module Populator
43
43
  end
44
44
  end
45
45
 
46
+ def attributes=(values_hash)
47
+ values_hash.each_pair do |key, value|
48
+ value = value.call if value.is_a?(Proc)
49
+ self.send((key.to_s + "=").to_sym, value)
50
+ end
51
+ end
52
+
46
53
  private
47
54
 
48
55
  def method_missing(sym, *args, &block)
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Populator-0.2.4
2
+ # Gem::Specification for Populator-0.2.5
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: populator
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.2.4
8
+ version: 0.2.5
9
9
  platform: ruby
10
10
  authors:
11
11
  - Ryan Bates
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-09-09 00:00:00 -07:00
15
+ date: 2008-10-01 00:00:00 -07:00
16
16
  default_executable:
17
17
  dependencies: []
18
18
 
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  version:
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "="
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: "1.2"
90
90
  version:
@@ -58,4 +58,17 @@ describe Populator::Record do
58
58
  Product.stubs(:column_names).returns(['id', 'foo'])
59
59
  Populator::Record.new(Product, 1).foo.should == 'Product'
60
60
  end
61
+
62
+ it "should allow set via attributes hash" do
63
+ record = Populator::Record.new(Product, 1)
64
+ record.attributes = {:stock => 2..5}
65
+ record.stock.should >= 2
66
+ record.stock.should <= 5
67
+ end
68
+
69
+ it "should take a proc object via attributes hash" do
70
+ record = Populator::Record.new(Product, 1)
71
+ record.attributes = {:stock => lambda {15}}
72
+ record.stock.should == 15
73
+ end
61
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-09 00:00:00 -07:00
12
+ date: 2008-10-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version:
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - "="
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: "1.2"
87
87
  version: