Class: Object

Inherits:
BasicObject
Defined in:
lib/pattern-match/core.rb,
lib/pattern-match/experimental.rb

Instance Method Summary collapse

Instance Method Details

#assert_pattern(pattern) ⇒ Object



41
42
43
44
45
# File 'lib/pattern-match/experimental.rb', line 41

def assert_pattern(pattern)
  match(self) do
    Kernel.eval("with(#{pattern}) { self }", Kernel.binding)
  end
end

#pattern_matcher(*subpatterns) ⇒ Object



11
12
13
# File 'lib/pattern-match/core.rb', line 11

def pattern_matcher(*subpatterns)
  PatternObjectDeconstructor.new(self, *subpatterns)
end