Class: QueryContext

Inherits:
Object
  • Object
show all
Defined in:
lib/optics-agent/query_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent, rack_env = false) ⇒ QueryContext

Returns a new instance of QueryContext.



5
6
7
8
9
# File 'lib/optics-agent/query_context.rb', line 5

def initialize(agent, rack_env = false)
  @agent = agent
  @query = OpticsAgent::Reporting::Query.new
  @rack_env = rack_env
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



4
5
6
# File 'lib/optics-agent/query_context.rb', line 4

def agent
  @agent
end

#no_rackObject (readonly)

Returns the value of attribute no_rack.



4
5
6
# File 'lib/optics-agent/query_context.rb', line 4

def no_rack
  @no_rack
end

#queryObject (readonly)

Returns the value of attribute query.



4
5
6
# File 'lib/optics-agent/query_context.rb', line 4

def query
  @query
end

Instance Method Details

#query_finished!Object



16
17
18
# File 'lib/optics-agent/query_context.rb', line 16

def query_finished!
  finish! unless @rack_env
end

#request_finished!Object



20
21
22
# File 'lib/optics-agent/query_context.rb', line 20

def request_finished!
  finish!
end

#with_document(query_string) ⇒ Object



11
12
13
14
# File 'lib/optics-agent/query_context.rb', line 11

def with_document(query_string)
  @query.document = query_string
  self
end