Class: Safer::HashProtocol::Compound

Inherits:
Base
  • Object
show all
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.

Direct Known Subclasses

All, Any

Instance Method Summary collapse

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.



135
136
137
138
139
140
141
142
# File 'lib/safer/hashprotocol.rb', line 135

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

Instance Method Details

#selfObject

:attr_reader: list Set of HashProtocol objects from which this object’s match operation should be derived.



129
# File 'lib/safer/hashprotocol.rb', line 129

Safer::IVar.export_reader(self, :list)