Class: Relaxo::QueryServer::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/relaxo/query_server/process.rb

Overview

A simple high level functional process attached to a given ‘context`. Typically used for executing functions from map/reduce and design documents.

Direct Known Subclasses

ListRenderer, MappingProcess, ReducingProcess

Instance Method Summary collapse

Constructor Details

#initialize(context, function) ⇒ Process

Returns a new instance of Process.



25
26
27
28
# File 'lib/relaxo/query_server/process.rb', line 25

def initialize(context, function)
	@context = context
	@function = function
end

Instance Method Details

#call(*args) ⇒ Object



34
35
36
# File 'lib/relaxo/query_server/process.rb', line 34

def call(*args)
	instance_exec *args, &@function
end

#log(message) ⇒ Object



30
31
32
# File 'lib/relaxo/query_server/process.rb', line 30

def log(message)
	@context.log message
end

#run(*args) ⇒ Object



38
39
40
# File 'lib/relaxo/query_server/process.rb', line 38

def run(*args)
	call(*args)
end