Class: Obj

Inherits:
Object
  • Object
show all
Includes:
Contracts
Defined in:
lib/contracts-ruby2/benchmarks/invariants.rb,
lib/contracts-ruby3/benchmarks/invariants.rb

Constant Summary

Constants included from Contracts

Contracts::VERSION

Constants included from Contracts::Builtin

Contracts::Builtin::ArrayOf, Contracts::Builtin::SetOf

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Contracts

extended, included

Methods included from Contracts::Attrs

#attr_accessor_with_contract, #attr_reader_with_contract, #attr_writer_with_contract

Constructor Details

#initialize(value) ⇒ Obj

Returns a new instance of Obj.



11
12
13
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 11

def initialize value
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



10
11
12
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 10

def value
  @value
end

Instance Method Details

#contracts_add(a, b) ⇒ Object



16
17
18
# File 'lib/contracts-ruby2/benchmarks/invariants.rb', line 16

def contracts_add a, b
  a + b
end