Class: Wool::SexpAnalysis::Protocols::UnionProtocol

Inherits:
Base
  • Object
show all
Defined in:
lib/wool/analysis/protocols.rb

Overview

This is a simple protocol whose signature set is just the union of the signature sets of its constituent protocols.

Instance Method Summary collapse

Methods inherited from Base

#<=>

Constructor Details

#initialize(constituents) ⇒ UnionProtocol

Initializes the Union protocol to a set of constituent protocols.

Parameters:

  • constituents (Array<Base>)

    the set of constituent protocols that this protocol is a union of.



36
37
38
# File 'lib/wool/analysis/protocols.rb', line 36

def initialize(constituents)
  @protocols = constituents
end

Instance Method Details

#signaturesArray<Signature>

Returns the list of all known signatures that this protocol responds to, which is the union of all the constituent protocols.

Returns:

  • (Array<Signature>)

    the supported signatures for this protocol.



44
45
46
# File 'lib/wool/analysis/protocols.rb', line 44

def signatures
  @protocols.map(&:signatures).inject(:|)
end