pragma-operation 1.2.2 → 1.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: b29615adbb2d556c4e4f2be02095b59bae75fe46
4
- data.tar.gz: 621e680a0eebf1fe5e191c734aa68efcf8119328
3
+ metadata.gz: de7f671cdcc96da6dcdfbeb86fe5fb18b779648b
4
+ data.tar.gz: 7114511c8435298744b6cc013c631ebc11a342f6
5
5
  SHA512:
6
- metadata.gz: b2d5b65686b852a0e7b4259fa50e960fd306bb7deabb235f43fd56b2313d34825082470991007c6bf4176e123718d2e28afc874367b106002074dc692df907b1
7
- data.tar.gz: 464634670e002f4fe54e48ceda7c810edcb8ac3aac09606d8a1d38471e3abb1f73eabfe36d5fe33b3ad87f63e3b73650cd3c518c070788539d3835562d1cbac1
6
+ metadata.gz: 8a0ce612dbb5b9922a102ea07c94f1369306ef46c79187789d1d3ea89b0a84c67fdb55d2e508a922b6a7689a5e770417b11fce102e221de8d426764c20689289
7
+ data.tar.gz: 16a91000d9daa183a4f13b83187c381f7cee3e5ee0bc06dc555f07cc472b6a36fa2298c709d59c3b77597f94573dca2d0181c418d4bdc52ed2b2151cc258ac54
@@ -63,7 +63,7 @@ module Pragma
63
63
  def authorize(authorizable)
64
64
  return true unless self.class.policy_klass
65
65
 
66
- policy = if authorizable.is_a?(self.class.policy_klass)
66
+ policy = if self.class.policy_klass && authorizable.is_a?(self.class.policy_klass)
67
67
  authorizable
68
68
  else
69
69
  build_policy(authorizable)
@@ -65,7 +65,7 @@ module Pragma
65
65
  #
66
66
  # @return [Boolean] whether the operation is valid
67
67
  def validate(validatable)
68
- contract = if validatable.is_a?(self.class.contract_klass)
68
+ contract = if self.class.contract_klass && validatable.is_a?(self.class.contract_klass)
69
69
  validatable
70
70
  else
71
71
  build_contract(validatable)
@@ -84,8 +84,7 @@ module Pragma
84
84
  #
85
85
  # @param validatable [Object|Pragma::Contract::Base] contract or resource
86
86
  def validate!(validatable)
87
- # rubocop:disable Metrics/LineLength
88
- contract = if defined?(Pragma::Contract::Base) && validatable.is_a?(Pragma::Contract::Base)
87
+ contract = if self.class.contract_klass && validatable.is_a?(self.class.contract_klass)
89
88
  validatable
90
89
  else
91
90
  build_contract(validatable)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Pragma
3
3
  module Operation
4
- VERSION = '1.2.2'
4
+ VERSION = '1.2.3'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragma-operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis