Class: Ree::Contracts::ContractDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/ree/contracts/contract_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contract) ⇒ ContractDefinition

Returns a new instance of ContractDefinition.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ree/contracts/contract_definition.rb', line 7

def initialize(contract)
  @arg_contracts, @return_contract = split_contract(contract)
  @block_contract = arg_contracts.pop if ArgContracts.opt_or_block?(arg_contracts.last)

  validate_block_contract
  validate_return_contract
  validate_kwargs_contract
  validate_splat_contract
  validate_ksplat_contract
  validate_dependent_contracts
end

Instance Attribute Details

#arg_contractsObject (readonly)

Returns the value of attribute arg_contracts.



5
6
7
# File 'lib/ree/contracts/contract_definition.rb', line 5

def arg_contracts
  @arg_contracts
end

#block_contractObject (readonly)

Returns the value of attribute block_contract.



5
6
7
# File 'lib/ree/contracts/contract_definition.rb', line 5

def block_contract
  @block_contract
end

#return_contractObject (readonly)

Returns the value of attribute return_contract.



5
6
7
# File 'lib/ree/contracts/contract_definition.rb', line 5

def return_contract
  @return_contract
end