Class: Primalize::Single::Match

Inherits:
Object
  • Object
show all
Includes:
Type
Defined in:
lib/primalize/single.rb

Constant Summary

Constants included from Type

Type::DEFAULT_COERCION

Instance Method Summary collapse

Methods included from Type

#coerce

Constructor Details

#initialize(matcher, &coercion) ⇒ Match

Returns a new instance of Match.



450
451
452
453
# File 'lib/primalize/single.rb', line 450

def initialize matcher, &coercion
  @matcher = matcher
  @coercion = coercion
end

Instance Method Details

#===(value) ⇒ Object



455
456
457
# File 'lib/primalize/single.rb', line 455

def === value
  @matcher === value
end

#inspectObject



459
460
461
# File 'lib/primalize/single.rb', line 459

def inspect
  "match(#{@matcher.inspect})"
end