tainbox 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bddb6130c428ff13481ff1758fbf20a44caf5eef
4
- data.tar.gz: e785b9801259f7a6f02520566fe7245d71b8ee41
3
+ metadata.gz: f1d90e3036928f02e1e541bb6be2442a2eef11dd
4
+ data.tar.gz: 8f82d0447b079b1eefd8ecd4770d80ae421a1419
5
5
  SHA512:
6
- metadata.gz: bfb32461b17e6b0267098db98ae63c302c2135527c0c8da568f806ca528ba4fc9c59c7ff0ed17a8aefcc00824dd1ca1e5c9f2d1254941df84118428645c00268
7
- data.tar.gz: 3a20a7f21e5700237c5a65826a7dfcb4149de9a7d5ac1563b79ab33ca789f5c64aa27ffedd62c720275bdbce27af73f2d3f69147107478cc4c6a6e2bbc4e852e
6
+ metadata.gz: b3dd133bcc4b170c2628c14f22338e546b1ce6d150347175997c2894411205943654193e52d7df51d32693300559c9ada285c3c0e6a54839206e16d83a594d31
7
+ data.tar.gz: ffc7c3348fc39ba1fec0d99f06016e3248ebbce12dacbde5516e194e4c9e7cb9355be11ef0d0c4c566ff3b92f845bb28617374a2ffc6b9af303583eea1db757c
data/README.md CHANGED
@@ -25,6 +25,19 @@ person.attributes = {}
25
25
  person.attributes # => { :name => "person_20", :age => 20 }
26
26
  ```
27
27
 
28
+ ## But what's wrong with Virtus?
29
+
30
+ Observe:
31
+
32
+ ``` ruby
33
+ class Person
34
+ include Virtus::Model
35
+ attribute :age, Integer
36
+ end
37
+
38
+ Person.new(age: 'invalid_integer').age # => "invalid_integer"
39
+ ```
40
+
28
41
  ## Additional features
29
42
 
30
43
  ### Method overrides
@@ -59,7 +72,7 @@ person.attribute_provided?(:age) # => false
59
72
  person.attribute_provided?(:name) # => true
60
73
  ```
61
74
 
62
- ### readonly and writeonly attributes
75
+ ### Readonly and writeonly attributes
63
76
 
64
77
  Speaks for itself:
65
78
 
@@ -7,7 +7,7 @@ module Tainbox::ClassMethods
7
7
  subclass.tainbox_attributes = tainbox_attributes.dup
8
8
  end
9
9
 
10
- def tainbox_initialize_suppressed?
10
+ def tainbox_initializer_suppressed?
11
11
  !!tainbox_initializer_suppressed
12
12
  end
13
13
 
@@ -5,10 +5,10 @@ require_relative 'extensions'
5
5
  module Tainbox::InstanceMethods
6
6
 
7
7
  def initialize(*args)
8
- attributes = (args.length >= 1) ? args.first : {}
9
- if self.class.tainbox_initialize_suppressed?
8
+ if self.class.tainbox_initializer_suppressed?
10
9
  super
11
10
  else
11
+ attributes = (args.length >= 1) ? args.first : {}
12
12
  self.attributes = attributes
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Tainbox
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tainbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Gubitskiy