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.
Files changed (2) hide show
  1. data/lib/machinist.rb +4 -8
  2. 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.new, attributes)
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(object, attributes)
53
- @object = 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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notahat-machinist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Yandell