class DataContract::ContractList
Attributes
obj[R]
Public Class Methods
new(obj=nil)
click to toggle source
# File lib/data_contract/contract_list.rb, line 5 def initialize(obj=nil) @obj = obj end
Public Instance Methods
[](mod)
click to toggle source
# File lib/data_contract/contract_list.rb, line 15 def [](mod) get mod end
assignable(receiver)
click to toggle source
# File lib/data_contract/contract_list.rb, line 19 def assignable(receiver) assignable_contracts = self.class.new obj each do |contract| if contract.assignable? receiver assignable_contracts << contract end end assignable_contracts end
get(mod)
click to toggle source
# File lib/data_contract/contract_list.rb, line 9 def get(mod) contract = find { |contract| contract.mod == mod } raise ContractError, "No contract for #{mod.name}" unless contract contract end
scatter(receiver, contract_module=nil)
click to toggle source
# File lib/data_contract/contract_list.rb, line 31 def scatter(receiver, contract_module=nil) Scatter.! self, receiver, contract_module end