class Primalize::Single::Optional
Public Class Methods
new(types, &coercion)
click to toggle source
# File lib/primalize/single.rb, line 369 def initialize types, &coercion @types = types @coercion = coercion end
Public Instance Methods
===(value)
click to toggle source
# File lib/primalize/single.rb, line 374 def === value value.nil? || @types.any? { |type| type === value } end
inspect()
click to toggle source
# File lib/primalize/single.rb, line 378 def inspect "optional(#{@types.map(&:inspect).join(', ')})" end