hexx 6.0.1 → 6.0.2

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: 0cdf93b0a9b2731e1132c5987fdc18d3d8d86817
4
- data.tar.gz: e3de7b204aa8c259b104de8474c78ddbdf444b94
3
+ metadata.gz: 5363a542691cf187bc33c6af98944fddd629b593
4
+ data.tar.gz: b86bd725ce6048ddb028316b574918980b844012
5
5
  SHA512:
6
- metadata.gz: dc228d070214f05121017f3a52c6356d7d0edd66cb284a87dcf088f1bda1542e94578c193af9f5036d067c7053f5210c57242916c7e1b80b19fa989c7efcfa7c
7
- data.tar.gz: bdef6fd6763889be4504d0960e634ea4b0870f00dce640f959019df447002aa1303a3d4d365a4830c6ebafe71bea5197ad479b23570c2d9e57d5d2598e79eb5b
6
+ metadata.gz: e451529cfaecd38210afa3d8e4206d23fbce09a1f966a8da564f20959eac30fc96c47e15ecf595ff7fd8b32ff818e5e06523e67b1f0d047f7fe678efddea4525
7
+ data.tar.gz: cb9ad8b597a55ce3f10c8c0246bb4e439489f528dd5806ced91a4547bfb1dc57fee7bf6a86ab5197feb9309ec5155c97b1912a15bdc8ae275d153e2bd791cede
@@ -109,8 +109,8 @@ the raw value (<tt>"Ivo"</tt>) and the coerced one (<tt>#<Coercer @wrapped_strin
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
- This feature is added for comparison with +ActiveRecord+ attributes coersion
113
- where the getter is given with stored raw values (a string etc.)
112
+ This feature is added for compatibility with +ActiveRecord+ attributes
113
+ whose getters gives raw values from a database.
114
114
 
115
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
@@ -26,18 +26,18 @@ module Hexx
26
26
  # Coerced the attribute(s) with given type.
27
27
  # @example (see Hexx::Coercible)
28
28
  # @param [Array<Symbol, String>] names The list of attributes to be coerced.
29
- # @param [Hash] options The coersion options.
30
- # @option options [Class] :type The class for coersion.
29
+ # @param [Hash] options The coercion options.
30
+ # @option options [Class] :type The class for coercion.
31
31
  def attr_coerced(*names, type:)
32
- names.flatten.each { |name| coersion.add self, name, type }
32
+ names.flatten.each { |name| coercion.add self, name, type }
33
33
  end
34
34
 
35
35
  # @api hide
36
- # The method returns a coersion creator for PORO object only.
36
+ # The method returns a coercion creator for PORO object only.
37
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
38
+ # @return [Class] attribute coercion (Hexx::Helpers::Coercion by default)
39
+ def coercion
40
+ Hexx::Helpers::Coercion
41
41
  end
42
42
  end
43
43
  end
@@ -8,13 +8,13 @@ module Hexx
8
8
  # Coerces class attribute getter and setter with given type.
9
9
  #
10
10
  # @example
11
- # Coersion.add MyClass, :name, Multibyte::Chars
11
+ # Coercion.add MyClass, :name, Multibyte::Chars
12
12
  # object = MyClass.new
13
13
  #
14
14
  # object.name = "Ivo"
15
15
  # object.name
16
16
  # # => #<Multibyte::Chars @wrapped_string="Ivo" >
17
- class Coersion < Base
17
+ class Coercion < Base
18
18
 
19
19
  # @api hide
20
20
  # @!scope class
@@ -22,11 +22,11 @@ module Hexx
22
22
  # Reloads the Base class initializer by adding the type of the attribute
23
23
  # to coerce with.
24
24
  #
25
- # @example (see Hexx::Helpers::Coersion)
25
+ # @example (see Hexx::Helpers::Coercion)
26
26
  # @param (see Hexx::Helpers::Base.add)
27
27
  # @param [Module] type The type of the attribute.
28
- # @raise (see Hexx::Helpers::Coersion#validate)
29
- # @return [Hexx::Helpers::Coersion] the coersion object.
28
+ # @raise (see Hexx::Helpers::Coercion#validate)
29
+ # @return [Hexx::Helpers::Coercion] the coercion object.
30
30
  def initialize(target, name, type)
31
31
  super target, name
32
32
  @type = type
@@ -38,14 +38,14 @@ module Hexx
38
38
  attr_accessor :type
39
39
 
40
40
  # @api hide
41
- # Validates parameters of the coersion declaration.
41
+ # Validates parameters of the coercion declaration.
42
42
  #
43
- # Adds validation of the coersion type to the
43
+ # Adds validation of the coercion type to the
44
44
  # {Hexx::Helper::Base#validate}.
45
45
  #
46
46
  # @raise (see Hexx::Helpers::Base.validate)
47
- # @raise (see Hexx::Helpers::Coersion#check_type)
48
- # @return [Hexx::Helpers::Coersion] +self+
47
+ # @raise (see Hexx::Helpers::Coercion#check_type)
48
+ # @return [Hexx::Helpers::Coercion] +self+
49
49
  def validate
50
50
  check_type
51
51
  super
@@ -2,5 +2,5 @@
2
2
  module Hexx
3
3
 
4
4
  # Current release.
5
- VERSION = "6.0.1"
5
+ VERSION = "6.0.2"
6
6
  end
@@ -9,13 +9,13 @@ module Hexx
9
9
 
10
10
  before { class TestModel; extend Coercible; end }
11
11
  before { module TestModule; end }
12
- before { class TestCoersion < Struct.new(:string); end }
12
+ before { class TestCoercion < Struct.new(:string); end }
13
13
 
14
14
  let(:test_model) { TestModel }
15
15
  let(:test_module) { TestModule }
16
- let(:test_coersion) { TestCoersion }
16
+ let(:test_coercion) { TestCoercion }
17
17
 
18
- after { Hexx.send :remove_const, :TestCoersion }
18
+ after { Hexx.send :remove_const, :TestCoercion }
19
19
  after { Hexx.send :remove_const, :TestModule }
20
20
  after { Hexx.send :remove_const, :TestModel }
21
21
 
@@ -25,12 +25,12 @@ module Hexx
25
25
 
26
26
  describe ".attr_coerced" do
27
27
 
28
- before { test_model.send :attr_coerced, :name, type: test_coersion }
28
+ before { test_model.send :attr_coerced, :name, type: test_coercion }
29
29
  subject { test_model.new }
30
30
 
31
31
  it "coerces an attribute with given type" do
32
32
  subject.name = "some name"
33
- expect(subject.name).to be_kind_of test_coersion
33
+ expect(subject.name).to be_kind_of test_coercion
34
34
  end
35
35
  end
36
36
  end
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.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin
@@ -153,7 +153,7 @@ files:
153
153
  - lib/hexx/configurable.rb
154
154
  - lib/hexx/dependable.rb
155
155
  - lib/hexx/helpers/base.rb
156
- - lib/hexx/helpers/coersion.rb
156
+ - lib/hexx/helpers/coercion.rb
157
157
  - lib/hexx/helpers/dependency.rb
158
158
  - lib/hexx/helpers/module_dependency.rb
159
159
  - lib/hexx/helpers/parameter.rb