Class: Safer::HashProtocol::Not

Inherits:
Single show all
Defined in:
lib/safer/hashprotocol.rb

Overview

Check that a base Safer::HashProtocol object does NOT match a Hash. That is, invert the match of a base HashProtocol object.

Instance Method Summary collapse

Methods inherited from Single

#self

Methods inherited from Base

#self

Constructor Details

#initialize(base) ⇒ Not

The description for this object will be “NOT #Safer::HashProtocol::Not.basebase.description”.



252
253
254
# File 'lib/safer/hashprotocol.rb', line 252

def initialize(base)
  super("NOT ", base)
end

Instance Method Details

#===(h) ⇒ Object

Check that the base object does NOT match the hash.



258
259
260
# File 'lib/safer/hashprotocol.rb', line 258

def ===(h)
  ! (self.base === h)
end

#match(h, remaining) ⇒ Object

Check that the base object does NOT match the hash. Does not update remaining under any circumstance.



265
266
267
# File 'lib/safer/hashprotocol.rb', line 265

def match(h, remaining)
  self === h
end