Class: Relaxo::QueryServer::Designer
- Inherits:
-
Object
- Object
- Relaxo::QueryServer::Designer
- Defined in:
- lib/relaxo/query_server/designer.rb
Overview
Implements the design document state and interface.
Instance Method Summary collapse
-
#create(name, attributes) ⇒ Object
Create a new design document.
-
#initialize(context) ⇒ Designer
constructor
A new instance of Designer.
-
#run(name, function, arguments) ⇒ Object
Run a function on a given design document.
Constructor Details
#initialize(context) ⇒ Designer
Returns a new instance of Designer.
217 218 219 220 |
# File 'lib/relaxo/query_server/designer.rb', line 217 def initialize(context) @context = context @documents = {} end |
Instance Method Details
#create(name, attributes) ⇒ Object
Create a new design document.
228 229 230 |
# 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) ⇒ Object
Run a function on a given design document.
240 241 242 243 244 245 246 |
# 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 |