Class: Safer::HashProtocol::Not
- 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
-
#===(h) ⇒ Object
Check that the base object does NOT match the hash.
-
#initialize(base) ⇒ Not
constructor
The description for this object will be “NOT #basebase.description”.
-
#match(h, remaining) ⇒ Object
Check that the base object does NOT match the hash.
Methods inherited from Single
Methods inherited from Base
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 |