class Relaxo::QueryServer::Designer

Implements the design document state and interface.

Public Class Methods

new(context) click to toggle source
# File lib/relaxo/query_server/designer.rb, line 217
def initialize(context)
        @context = context
        @documents = {}
end

Public Instance Methods

create(name, attributes) click to toggle source

Create a new design document.

@param [String] name

The name of the design document.

@param [Hash] attributes

The contents of the design document.
# File lib/relaxo/query_server/designer.rb, line 228
def create(name, attributes)
        @documents[name] = DesignDocument.new(@context, name, attributes)
end
run(name, function, arguments) click to toggle source

Run a function on a given design document.

@param [String] name

The name of the design document.

@param [Array] function

A key path to the function to execute.

@param [Array] arguments

The arguments to provide to the function.
# File lib/relaxo/query_server/designer.rb, line 240
def run(name, function, arguments)
        document = @documents[name]
        
        raise ArgumentError.new("Invalid document name #{name}") unless document
        
        document.run(function, arguments)
end