Module: Collab::JS
- Defined in:
- lib/collab/js.rb
Defined Under Namespace
Classes: JSProcess, JSRuntimeError
Class Method Summary
collapse
Class Method Details
.apply_commit(document, commit, schema_name:) ⇒ Object
28
29
30
|
# File 'lib/collab/js.rb', line 28
def apply_commit(document, commit, schema_name:)
call("applyCommit", {doc: document, commit: commit}, schema_name: schema_name)
end
|
.call(name, data = nil, schema_name:) ⇒ Object
24
25
26
|
# File 'lib/collab/js.rb', line 24
def call(name, data = nil, schema_name:)
with_js { |js| js.call(name, *arguments, &block) }
end
|
.document_to_html(document, schema_name:) ⇒ Object
36
37
38
|
# File 'lib/collab/js.rb', line 36
def document_to_html(document, schema_name:)
call("docToHtml", document, schema_name: schema_name)
end
|
.html_to_document(html, schema_name:) ⇒ Object
32
33
34
|
# File 'lib/collab/js.rb', line 32
def html_to_document(html, schema_name:)
call("htmlToDoc", html, schema_name: schema_name)
end
|
.queue ⇒ Object
10
11
12
13
|
# File 'lib/collab/js.rb', line 10
def queue
initialize_queue unless @queue_initialized
@queue
end
|
.with_js ⇒ Object
Calls the block given with a JS process acquired from the queue Will block until a JS process is available
17
18
19
20
21
22
|
# File 'lib/collab/js.rb', line 17
def with_js
js = queue.pop
yield js
ensure
queue << js
end
|