Class: Safer::HashProtocol::Compound
- Defined in:
- lib/safer/hashprotocol.rb
Overview
Base class of Safer::HashProtocol implementations that provide some derived value from a set of other HashProtocol implementations.
Instance Method Summary collapse
-
#initialize(sep, *list) ⇒ Compound
constructor
Stores the description and set of base HashProtocol objects in this HashProtocol object.
-
#self ⇒ Object
:attr_reader: list Set of HashProtocol objects from which this object’s match operation should be derived.
Constructor Details
#initialize(sep, *list) ⇒ Compound
Stores the description and set of base HashProtocol objects in this HashProtocol object. The description is derived from the description of the base HashProtocol objects, with sep
between each element.
134 135 136 137 138 139 140 141 |
# File 'lib/safer/hashprotocol.rb', line 134 def initialize(sep, *list) desc = list.map do |el| Protocol.instance_conforms?(el) "(#{el.description})" end.join(sep) super(desc) self.safer_hashprotocol_compound__list = list end |