hexx 6.0.0 → 6.0.1

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: 2e8768af29b2a06a1eec7ae917896144373edf4e
4
- data.tar.gz: 33b14d58fda376b285b3674a69efc05fcf0ad3d9
3
+ metadata.gz: 0cdf93b0a9b2731e1132c5987fdc18d3d8d86817
4
+ data.tar.gz: e3de7b204aa8c259b104de8474c78ddbdf444b94
5
5
  SHA512:
6
- metadata.gz: 688a02c4e5b617233bd222451e44580e4974e0ba93a54ae6532ba160a01aa37c4bbd67d0db3ee12b22a19567502947a6b7cb29cf79883a23b476093a1e8f67c3
7
- data.tar.gz: 32504f32691f79843f70416690f75c70f9679e8517659d3cec6ff62029365341673d017a1555e1de2137e1b80ca314a9e9fec6cd8917a2de1f9801100f089b31
6
+ metadata.gz: dc228d070214f05121017f3a52c6356d7d0edd66cb284a87dcf088f1bda1542e94578c193af9f5036d067c7053f5210c57242916c7e1b80b19fa989c7efcfa7c
7
+ data.tar.gz: bdef6fd6763889be4504d0960e634ea4b0870f00dce640f959019df447002aa1303a3d4d365a4830c6ebafe71bea5197ad479b23570c2d9e57d5d2598e79eb5b
@@ -105,14 +105,14 @@ the +Coercer+ class.
105
105
  # #<Coercer @wrapped_string="Ivo" >
106
106
 
107
107
  Be careful when designing a coercer class. Its constructor should accept both
108
- the raw value ("Ivo") and the coerced one (#<Coercer @wrapped_string = "Ivo">).
108
+ the raw value (<tt>"Ivo"</tt>) and the coerced one (<tt>#<Coercer @wrapped_string = "Ivo"></tt>).
109
109
  This is needed because the coercer works twofold - it coerces both the
110
110
  setter and getter. The getter coercer will take the coerced value.
111
111
 
112
112
  This feature is added for comparison with +ActiveRecord+ attributes coersion
113
113
  where the getter is given with stored raw values (a string etc.)
114
114
 
115
- *Note*: The coercer from +hexx+ gem itself won't work for +ActiveRecord+ models.
115
+ *Note*: The coercer from the +hexx+ gem itself won't work for +ActiveRecord+ models.
116
116
  Use the +hexx-active_record+ gem instead. The gem extends the +Coercible+ model
117
117
  so that the +attr_coerced+ reloads +ActiveRecord+ attributes properly.
118
118
 
@@ -254,7 +254,7 @@ Inside a service use the +add_message+ to add message to the +messages+ array:
254
254
 
255
255
  The class implements the {Null object}[http://robots.thoughtbot.com/rails-refactoring-example-introduce-null-object] pattern. The object:
256
256
 
257
- * responds like +nil+ to +<=>+, +eq?+, +nil?+, +false?+, +true?+, +to_s+,
257
+ * responds like +nil+ to <tt><=></tt>, +eq?+, +nil?+, +false?+, +true?+, +to_s+,
258
258
  +to_i+, +to_f+, +to_c+, +to_r+, +to_nil+
259
259
  * responds with +self+ to any other method call
260
260
 
@@ -22,12 +22,6 @@ module Hexx
22
22
 
23
23
  private
24
24
 
25
- # @api hide
26
- def self.extended(klass)
27
- klass.send :extend, Configurable
28
- klass.send :depends_on, :coersion, default: Helpers::Coersion
29
- end
30
-
31
25
  # @!method attr_coerced(*names, options)
32
26
  # Coerced the attribute(s) with given type.
33
27
  # @example (see Hexx::Coercible)
@@ -37,5 +31,13 @@ module Hexx
37
31
  def attr_coerced(*names, type:)
38
32
  names.flatten.each { |name| coersion.add self, name, type }
39
33
  end
34
+
35
+ # @api hide
36
+ # The method returns a coersion creator for PORO object only.
37
+ # To be reloaded for ActiveRecord models
38
+ # @return [Class] attribute coersion (Hexx::Helpers::Coersion by default)
39
+ def coersion
40
+ @coersion ||= Hexx::Helpers::Coersion
41
+ end
40
42
  end
41
43
  end
@@ -2,5 +2,5 @@
2
2
  module Hexx
3
3
 
4
4
  # Current release.
5
- VERSION = "6.0.0"
5
+ VERSION = "6.0.1"
6
6
  end
@@ -23,25 +23,6 @@ module Hexx
23
23
  # Run tests
24
24
  # ==========================================================================
25
25
 
26
- describe ".coersion" do
27
-
28
- it "is defined" do
29
- expect(test_model).to respond_to :coersion
30
- end
31
-
32
- it "is set by default" do
33
- expect(test_model.coersion).to be_kind_of Module
34
- end
35
- end
36
-
37
- describe ".coersion=" do
38
-
39
- it "sets the .coersion" do
40
- expect { test_model.coersion = test_module }
41
- .to change { test_model.coersion }.to test_module
42
- end
43
- end
44
-
45
26
  describe ".attr_coerced" do
46
27
 
47
28
  before { test_model.send :attr_coerced, :name, type: test_coersion }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexx
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin