class Machete::Matchers::NodeMatcher
Attributes
attrs[R]
class_name[R]
Public Class Methods
new(class_name, attrs = {})
click to toggle source
# File lib/machete/matchers.rb, line 42 def initialize(class_name, attrs = {}) @class_name, @attrs = class_name, attrs end
Public Instance Methods
==(other)
click to toggle source
# File lib/machete/matchers.rb, line 46 def ==(other) other.instance_of?(self.class) && @class_name == other.class_name && @attrs == other.attrs end
matches?(node)
click to toggle source
# File lib/machete/matchers.rb, line 52 def matches?(node) node.class == Rubinius::AST.const_get(@class_name) && @attrs.all? { |name, matcher| matcher.matches?(node.send(name)) } end