hash_mapper 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e29d4658750442de3a4cfff45d3d1d68918a8afe642eb7e3f4c6563363d56523
4
- data.tar.gz: 74ce329715482ba68d540e2934ed35a2c350b31cdc3541ff0811c798d819fcde
3
+ metadata.gz: 3bddd2af1ce1793dad8c629df875b3896616603d26ca85d1373acf19bc366c8a
4
+ data.tar.gz: c3c7d3ea740effd2faa8e870025e1bdff510e99fd6d03981be91facb23f014b1
5
5
  SHA512:
6
- metadata.gz: f38ea8ead433e22f77877b3ca1f00f6ad21480c3c534ad1de2aae5a0039976085a6beb7e23ad5e5bf57a526208977edf785c34009c3e51c551a69b27d9f4ff61
7
- data.tar.gz: 7c2a62a3e9629b3db6899b9359640c4aecd32f4095a9d6571f1987eda4ee769393bb94de31215540214c49cd57390c28472c47139f465047c8d8788dfa9a94be
6
+ metadata.gz: ae9aa35b6b73b898c1db69c1fe154578035286f1ed4bc77d8d413aa44b8225b8425c0b40f897236a07e9ba2b96520bc7c09b80d63d286cd4e2a0f8f1ecc05822
7
+ data.tar.gz: 5c708bb349d7aa178a5461e3e6076cb838ee3aef005eebc7437f85b135dc79c268f7dc08436211959f637ceb94a34ce0e291cc3eb7990a76757f15b2b665e797
@@ -40,6 +40,8 @@ end
40
40
 
41
41
  module HashMapper
42
42
  DEFAULT_OPTIONS = {}.freeze
43
+ NO_VALUE = :hash_mapper_no_value
44
+ NO_DEFAULT = :hash_mapper_no_default
43
45
 
44
46
  def self.extended(base)
45
47
  base.class_eval do
@@ -130,7 +132,7 @@ module HashMapper
130
132
  @path_from = path_from
131
133
  @path_to = path_to
132
134
  @delegated_mapper = options.fetch(:using, nil)
133
- @default_value = options.fetch(:default, :hash_mapper_no_default)
135
+ @default_value = options.fetch(:default, NO_DEFAULT)
134
136
  end
135
137
 
136
138
  def process_into(output, input, method_name: :normalize, context: nil)
@@ -147,15 +149,15 @@ module HashMapper
147
149
  else
148
150
  v = h[e]
149
151
  end
150
- return :hash_mapper_no_value if v.nil?
152
+ return NO_VALUE if v.nil?
151
153
  v
152
154
  end
153
155
  delegated_mapper ? delegate_to_nested_mapper(value, method_name, context: context) : value
154
156
  end
155
157
 
156
158
  def set_value_in_output(output, path, value)
157
- if value == :hash_mapper_no_value
158
- if default_value == :hash_mapper_no_default
159
+ if value == NO_VALUE
160
+ if default_value == NO_DEFAULT
159
161
  return
160
162
  else
161
163
  value = default_value
@@ -169,7 +171,7 @@ module HashMapper
169
171
  when Array
170
172
  value.map {|v| delegated_mapper.public_send(method_name, v, context: context)}
171
173
  when nil
172
- return :hash_mapper_no_value
174
+ return NO_VALUE
173
175
  else
174
176
  delegated_mapper.public_send(method_name, value, context: context)
175
177
  end
@@ -1,3 +1,3 @@
1
1
  module HashMapper
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport