Class: ObjWithInvariants
- Inherits:
-
Object
- Object
- ObjWithInvariants
- Includes:
- Contracts, Contracts::Invariants
- Defined in:
- lib/contracts-ruby2/benchmarks/invariants.rb,
lib/contracts-ruby3/benchmarks/invariants.rb
Constant Summary
Constants included from Contracts
Constants included from Contracts::Builtin
Contracts::Builtin::ArrayOf, Contracts::Builtin::SetOf
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #contracts_add(a, b) ⇒ Object
-
#initialize(value) ⇒ ObjWithInvariants
constructor
A new instance of ObjWithInvariants.
Methods included from Contracts::Invariants
common, extended, included, #verify_invariants!
Methods included from Contracts
Methods included from Contracts::Attrs
#attr_accessor_with_contract, #attr_reader_with_contract, #attr_writer_with_contract
Constructor Details
#initialize(value) ⇒ ObjWithInvariants
Returns a new instance of ObjWithInvariants.
29 30 31 |
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 29 def initialize value @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
28 29 30 |
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 28 def value @value end |
Instance Method Details
#contracts_add(a, b) ⇒ Object
34 35 36 |
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 34 def contracts_add a, b a + b end |