Module: Fdlint::Parser::HTML::Matchable

Included in:
Element, Property, Tag
Defined in:
lib/fdlint/parser/html/struct.rb

Instance Method Summary collapse

Instance Method Details

#=~(patten) ⇒ Object Also known as: name_equal?



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fdlint/parser/html/struct.rb', line 17

def =~ patten
  name = respond_to?(:name) ? self.name :
         respond_to?(:tag_name) ? tag_name :
         nil
  if name
    case patten
    when String, Symbol
      name =~ Regexp.new("^#{patten}$", Regexp::IGNORECASE)
    when Regexp
      name =~ patten
    end
  end
end