Class: Sexp

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_diff/patterns.rb

Instance Method Summary collapse

Instance Method Details

#match(pattern, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ruby_diff/patterns.rb', line 17

def match(pattern, &block)
  if pattern == self
    block.call(self)
  end

  self.each do |subset|
    case subset
    when Sexp then
      subset.match(pattern, &block)
    end
  end
end