value_object_ar 0.0.3 → 0.0.4

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/lib/methods.rb CHANGED
@@ -26,7 +26,7 @@ module ValueObjectAR
26
26
  else
27
27
  value_or_object
28
28
  end
29
- attributes[attribute.to_s] = value
29
+ super(value)
30
30
  end
31
31
  end
32
32
 
@@ -37,12 +37,8 @@ class CurrencyValueObject
37
37
 
38
38
  end
39
39
 
40
- class Product
41
-
40
+ class ActiveRecord::Mock
42
41
  include ValueObjectAR::Methods
43
- value_object :currency, CurrencyValueObject
44
-
45
- # ActiveRecord behaviour below:
46
42
  attr_accessor :attributes
47
43
 
48
44
  def initialize(options={})
@@ -50,7 +46,14 @@ class Product
50
46
  end
51
47
 
52
48
  def attributes
53
- @attributes ||= {'currency' => nil}
49
+ @attributes ||= {}
54
50
  end
55
51
 
52
+ def currency=(value)
53
+ attributes['currency'] = value
54
+ end
55
+ end
56
+
57
+ class Product < ActiveRecord::Mock
58
+ value_object :currency, CurrencyValueObject
56
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: value_object_ar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: