Get the css selector in string from the cache
# File lib/nokogiri/css/parser.rb, line 17 17: def [] string 18: return unless @cache_on 19: @mutex.synchronize { @cache[string] } 20: end
Set the css selector in string in the cache to value
# File lib/nokogiri/css/parser.rb, line 23 23: def []= string, value 24: return value unless @cache_on 25: @mutex.synchronize { @cache[string] = value } 26: end
Clear the cache
# File lib/nokogiri/css/parser.rb, line 29 29: def clear_cache 30: @mutex.synchronize { @cache = {} } 31: end
Create a new CSS parser with respect to namespaces
# File lib/nokogiri/css/parser.rb, line 54 54: def initialize namespaces = {} 55: @namespaces = namespaces 56: super() 57: end
Parse this CSS selector in selector. Returns an AST.
# File lib/nokogiri/css/parser.rb, line 43 43: def parse selector 44: @warned ||= false 45: unless @warned 46: $stderr.puts('Nokogiri::CSS::Parser.parse is deprecated, call Nokogiri::CSS.parse(), this will be removed August 1st or version 1.4.0 (whichever is first)') 47: @warned = true 48: end 49: new.parse selector 50: end
On CSS parser error, raise an exception
# File lib/nokogiri/css/parser.rb, line 76 76: def on_error error_token_id, error_value, value_stack 77: after = value_stack.compact.last 78: raise SyntaxError.new("unexpected '#{error_value}' after '#{after}'") 79: end
Get the xpath for string using options
# File lib/nokogiri/css/parser.rb, line 61 61: def xpath_for string, options={} 62: key = "#{string}#{options[:ns]}#{options[:prefix]}" 63: v = self.class[key] 64: return v if v 65: 66: args = [ 67: options[:prefix] || '//', 68: options[:visitor] || XPathVisitor.new 69: ] 70: self.class[key] = parse(string).map { |ast| 71: ast.to_xpath(*args) 72: } 73: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.