notahat-machinist 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/machinist.rb +4 -8
- metadata +1 -1
data/lib/machinist.rb
CHANGED
@@ -29,7 +29,7 @@ module Machinist
|
|
29
29
|
|
30
30
|
def make(attributes = {})
|
31
31
|
raise "No blueprint for class #{self}" if @blueprint.nil?
|
32
|
-
lathe = Lathe.new(self
|
32
|
+
lathe = Lathe.new(self, attributes)
|
33
33
|
lathe.instance_eval(&@blueprint)
|
34
34
|
unless Machinist.nerfed?
|
35
35
|
lathe.object.save!
|
@@ -49,13 +49,9 @@ module Machinist
|
|
49
49
|
end
|
50
50
|
|
51
51
|
class Lathe
|
52
|
-
def initialize(
|
53
|
-
@object =
|
54
|
-
@assigned_attributes =
|
55
|
-
attributes.each do |key, value|
|
56
|
-
@object.send("#{key}=", value)
|
57
|
-
@assigned_attributes << key
|
58
|
-
end
|
52
|
+
def initialize(klass, attributes)
|
53
|
+
@object = klass.new(attributes)
|
54
|
+
@assigned_attributes = attributes.keys
|
59
55
|
end
|
60
56
|
|
61
57
|
attr_reader :object
|