populator 0.2.4 → 0.2.5
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.
- data/CHANGELOG +6 -0
- data/Rakefile +1 -1
- data/lib/populator/record.rb +7 -0
- data/populator.gemspec +4 -4
- data/spec/populator/record_spec.rb +13 -0
- metadata +3 -3
data/CHANGELOG
CHANGED
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.
|
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"
|
data/lib/populator/record.rb
CHANGED
@@ -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)
|
data/populator.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Populator-0.2.
|
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.
|
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-
|
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
|
+
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-
|
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:
|