Class: Rusty::Selector::CachedCSS

Inherits:
CSS
  • Object
show all
Defined in:
lib/rusty/selector.rb

Overview

A cached CSS selector, caches matching nodes within a document.

Instance Attribute Summary

Attributes inherited from CSS

#matcher

Instance Method Summary collapse

Methods inherited from CSS

#initialize, #weight

Constructor Details

This class inherits a constructor from Rusty::Selector::CSS

Instance Method Details

#match?(node) ⇒ Boolean

Does this selector matches a specific node?

Returns:

  • (Boolean)


57
58
59
60
61
62
# File 'lib/rusty/selector.rb', line 57

def match?(node)
  return false unless node
  
  cache_document(node.document)
  @matching_nodes.include?(node)
end