Module: PatternMatch::Extractable

Defined in:
lib/pattern-match.rb

Instance Method Summary collapse

Instance Method Details

#call(*subpatterns) ⇒ Object Also known as: []



25
26
27
28
29
30
31
32
# File 'lib/pattern-match.rb', line 25

def call(*subpatterns)
  if Object == self
    raise MalformedPatternError unless subpatterns.length == 1
    PatternObject.new(subpatterns[0])
  else
    PatternExtractor.new(self, *subpatterns)
  end
end