Module: Contracts::Invariants::InvariantExtension

Defined in:
lib/contracts/invariants.rb

Instance Method Summary collapse

Instance Method Details

#invariant(name, &condition) ⇒ Object



28
29
30
31
32
# File 'lib/contracts/invariants.rb', line 28

def invariant(name, &condition)
  return if ENV["NO_CONTRACTS"]

  invariants << Invariant.new(self, name, &condition)
end

#invariantsObject



34
35
36
# File 'lib/contracts/invariants.rb', line 34

def invariants
  @invariants ||= []
end