Class: REXML::CSSSelector::QueryContext

Inherits:
Object
  • Object
show all
Defined in:
lib/rexml/css_selector/query_context.rb

Overview

QueryContext is a context on matching CSS selector.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope:, substitutions:, adapter:, options:) ⇒ QueryContext

Returns a new instance of QueryContext.



7
8
9
10
11
12
13
# File 'lib/rexml/css_selector/query_context.rb', line 7

def initialize(scope:, substitutions:, adapter:, options:)
  @scope = scope
  @substitutions = substitutions
  @adapter = adapter
  @options = options
  @cache = {}
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



15
16
17
# File 'lib/rexml/css_selector/query_context.rb', line 15

def adapter
  @adapter
end

#cacheObject (readonly)

Returns the value of attribute cache.



15
16
17
# File 'lib/rexml/css_selector/query_context.rb', line 15

def cache
  @cache
end

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/rexml/css_selector/query_context.rb', line 15

def options
  @options
end

#scopeObject (readonly)

Returns the value of attribute scope.



15
16
17
# File 'lib/rexml/css_selector/query_context.rb', line 15

def scope
  @scope
end

#substitutionsObject (readonly)

Returns the value of attribute substitutions.



15
16
17
# File 'lib/rexml/css_selector/query_context.rb', line 15

def substitutions
  @substitutions
end

Instance Method Details

#scoped(new_scope) ⇒ Object



17
18
19
20
21
22
# File 'lib/rexml/css_selector/query_context.rb', line 17

def scoped(new_scope)
  old_scope = @scope
  @scope = new_scope
  yield
  @scope = old_scope
end