Class: JobContracts::ReadOnlyContract

Inherits:
Contract
  • Object
show all
Defined in:
lib/job_contracts/contracts/read_only_contract.rb

Defined Under Namespace

Modules: ContractableIncludes, ContractablePrepends

Instance Attribute Summary

Attributes inherited from Contract

#queues, #trigger

Instance Method Summary collapse

Methods inherited from Contract

#actual, #after?, #before?, #breached?, #expected, #halt?, #initialize, #satisfied?, #should_enforce?, #to_h

Constructor Details

This class inherits a constructor from JobContracts::Contract

Instance Method Details

#enforce!(contractable) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/job_contracts/contracts/read_only_contract.rb', line 31

def enforce!(contractable)
  self.satisfied = true
  if contractable.read_only_error.present?
    actual[:error] = contractable.read_only_error.message
    self.satisfied = false
  end
  super
end