Module: Contracts::Attrs

Included in:
Contracts
Defined in:
lib/contracts/attrs.rb

Instance Method Summary collapse

Instance Method Details

#attr_accessor_with_contract(*names, contract) ⇒ Object



13
14
15
16
# File 'lib/contracts/attrs.rb', line 13

def attr_accessor_with_contract(*names, contract)
  attr_reader_with_contract(*names, contract)
  attr_writer_with_contract(*names, contract)
end

#attr_reader_with_contract(*names, contract) ⇒ Object



3
4
5
6
# File 'lib/contracts/attrs.rb', line 3

def attr_reader_with_contract(*names, contract)
  Contract Contracts::None => contract
  attr_reader(*names)
end

#attr_writer_with_contract(*names, contract) ⇒ Object



8
9
10
11
# File 'lib/contracts/attrs.rb', line 8

def attr_writer_with_contract(*names, contract)
  Contract contract => contract
  attr_writer(*names)
end