Class: Hashape::Specifiers::Optional

Inherits:
Specifier
  • Object
show all
Defined in:
lib/hashape.rb

Overview

Allows a type spec to also be nil.

Instance Attribute Summary

Attributes inherited from Specifier

#spec

Instance Method Summary collapse

Methods inherited from Specifier

[], #initialize

Constructor Details

This class inherits a constructor from Hashape::Specifiers::Specifier

Instance Method Details

#===(v) ⇒ Object



37
38
39
# File 'lib/hashape.rb', line 37

def ===(v)
  v.nil? || self.spec === v
end