Class: Safer::HashProtocol::Single

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 single “base” implementation.

Direct Known Subclasses

Not, Only

Instance Method Summary collapse

Constructor Details

#initialize(prefix, base) ⇒ Single

Stores the description and base HashProtocol object in this HashProtocol object. The description is derived from the description of the base object, prepended by prefix.



111
112
113
114
115
# File 'lib/safer/hashprotocol.rb', line 111

def initialize(prefix, base)
  Protocol.instance_conforms?(base)
  super("#{prefix}#{base.description}")
  self.safer_hashprotocol_single__base = base
end

Instance Method Details

#selfObject

:attr_reader: base Base HashProtocol object from which this object’s match operation should be derived.



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

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