collab 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33a46319692ddad8b92b0eb4357b20e403ddea43b89ea19af20a077879473ed9
4
- data.tar.gz: 36bf0f90b4074a71492face5d1a35c3521d915a4c5573bf59716203f462c7b82
3
+ metadata.gz: eb2ee35163aa059b11156c14d30c0366c5f69b79475e0c7d7ee5a97fbcf9ade9
4
+ data.tar.gz: ded15f9d6aebc4fcd40adf92cb8105caeddd94b9894e596fe05fea1943518fa0
5
5
  SHA512:
6
- metadata.gz: b80ea065ae82935bc561e958c8b3e6f5678b6b9ad83115528b84ee6fa8d7defb0f70accbbc9cb188b4871ddb7dd25957b3ee6048c9dd694c491f9573ce5d2e3c
7
- data.tar.gz: a25048d323302fe52fb22e500d32946ec25d307c0ab4d8ced098e5d075a4598743dec46ff37ccd159332a79e007eb9bb7c48d2d1d1c2c5b7471da4210800bee0
6
+ metadata.gz: fe270eefabd2bc3753bef65a2892a359da7b9c16a6d4d2dff3d94006645a767744aad493268a795d6f339cf0e13259b6d0d6a383656da2b811c0aae4262fcf03
7
+ data.tar.gz: 40da589d2a889569e10bbc6541892388ee6f061f0a6bca73fee2c8b470498a9211fd546c738da7dd184aa936ed56b2f5939136a82e0435195a0c85454b799961
@@ -1,4 +1,3 @@
1
- require "collab/config"
2
1
  require "collab/railtie"
3
2
 
4
3
  module Collab
@@ -8,6 +7,7 @@ module Collab
8
7
  yield @config
9
8
  end
10
9
 
10
+ autoload "Config", "collab/config"
11
11
  autoload "Bridge", "collab/bridge"
12
12
  autoload "HasCollaborativeDocument", "collab/has_collaborative_document"
13
13
 
@@ -31,24 +31,24 @@ module Collab
31
31
  @current ||= new
32
32
  end
33
33
 
34
- def call(name, data = nil, schemaName:)
35
- req = {name: name, data: data, schemaPackage: ::Collab.config.schema_package, schemaName: schemaName}
34
+ def call(name, data = nil, schema_name:)
35
+ req = {name: name, data: data, schemaPackage: ::Collab.config.schema_package, schemaName: schema_name}
36
36
  @node.puts(JSON.generate(req))
37
37
  res = JSON.parse(@node.gets)
38
38
  raise ::Collab::Bridge::JSRuntimeError.new(res["error"]) if res["error"]
39
39
  res["result"]
40
40
  end
41
41
 
42
- def apply_transaction(document, transaction, schemaName:)
43
- call("applyTransaction", {doc: document, data: transaction}, schemaName: schemaName)
42
+ def apply_transaction(document, transaction, schema_name:)
43
+ call("applyTransaction", {doc: document, data: transaction}, schema_name: schema_name)
44
44
  end
45
45
 
46
- def html_to_document(html, schemaName:)
47
- call("htmlToDoc", html, schemaName: schemaName)
46
+ def html_to_document(html, schema_name:)
47
+ call("htmlToDoc", html, schema_name: schema_name)
48
48
  end
49
49
 
50
- def document_to_html(document, schemaName:)
51
- call("docToHtml", document, schemaName: schemaName)
50
+ def document_to_html(document, schema_name:)
51
+ call("docToHtml", document, schema_name: schema_name)
52
52
  end
53
53
  end
54
54
  end
@@ -29,8 +29,6 @@ module Collab
29
29
  end
30
30
 
31
31
  def from_html(html)
32
- raise "cannot override a persisted document" if self.persisted?
33
-
34
32
  self.document = ::Collab::Bridge.current.html_to_document(html, schema_name: schema_name)
35
33
  end
36
34
 
@@ -1,3 +1,3 @@
1
1
  module Collab
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -17,7 +17,7 @@ class CreateCollabTables < ActiveRecord::Migration[6.0]
17
17
  end
18
18
 
19
19
  create_table :collab_document_transactions, id: false do |t|
20
- t.references :document, null: false, foreign_key: {to_table: :collaborative_documents}, type: :uuid, index: false
20
+ t.references :document, null: false, foreign_key: {to_table: :collab_documents}, type: :uuid, index: false
21
21
 
22
22
  t.jsonb :steps, array: true, null: false
23
23
  t.integer :document_version, null: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Aubin