standalone_validator 0.2.1 → 0.2.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: ee76a41270f159a0fa58356c11739379f388b937
4
- data.tar.gz: f482deae225caae5f396ff7995b808472e170573
3
+ metadata.gz: 74966f834d724f4de6f147b10b498132ef024a22
4
+ data.tar.gz: af174e753d0c11b44577b83f29c4927a9319783b
5
5
  SHA512:
6
- metadata.gz: 8f9183664c27a3bf6cfb812d8a47ebf5f2b15d83e548974b7e77e0ae1b899c0e13550b74f815fd1506276a998c3fb05b689ed1ecb15dd2e4d532f73b145b3aa9
7
- data.tar.gz: 52ace947a6ff30a932c9c25e3db10be2d4625ad7280fa05f21cda29f9727e37faf35208d8c89c4b2264fd19332e9fa7089c7f224c7bcafa3021db4b933cbd17d
6
+ metadata.gz: fd12fd173f0e570aae00e77e229f740ad7b30066685c62a6be910d4b85a17a49173ff14f4a439dd56be1acc6c4726d8864bd497241601f5ee0587842126fa8bd
7
+ data.tar.gz: 89125f6d7236d1f65912605a8974b22daf6bb365f88b6b46529e3ff3f600f77957c2bd5468ba3db9b4dcf05392b9c3afbb30adb14888ffbd65c8ab50cec28531
@@ -33,7 +33,7 @@ class StandaloneValidator
33
33
  module ClassMethods
34
34
  def include_validation(&block)
35
35
  super do |object, result|
36
- if instance_exec(object, &condition)
36
+ if evaluate_condition(object)
37
37
  instance_exec(object, result, &block)
38
38
  end
39
39
  end
@@ -50,6 +50,10 @@ class StandaloneValidator
50
50
  private
51
51
  attr_reader :attributes, :options
52
52
 
53
+ def evaluate_condition(object)
54
+ instance_exec(object, &condition)
55
+ end
56
+
53
57
  def condition
54
58
  @condition ||= CommonRailsOptions.condition_for(options)
55
59
  end
@@ -17,7 +17,7 @@ class StandaloneValidator
17
17
  end
18
18
 
19
19
  def requires_field?(field, object)
20
- attributes.include?(field.to_sym) && condition.call(object)
20
+ attributes.include?(field.to_sym) && evaluate_condition(object)
21
21
  end
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  class StandaloneValidator
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standalone_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renato Zannon