live 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/live/element.rb +10 -2
- data/lib/live/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41876a4b4870415b70d8e5747dce78f8eeed867b524bad32b9a0146c56296f41
|
4
|
+
data.tar.gz: ba656166a150f8d5a2da0ce37bc358159eb082db4b6340ef751cc2ff3b9f00d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d76c89db7212a85596ef74630816a88107fc752ac8e932f76b43d5e2d943bbb4e631f4a78a44b7c9e4c6ef2095defce9c5d8da83f9334f171afe20d9a41ad6
|
7
|
+
data.tar.gz: 86484b279c0a6c16f4d46fe2220627ba35a74810413108377bf4f8002c84c95681bea4f1d7c760842b48bdc10e5c5c7cecdc9e3c7723700df3f415e51256d1f4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/live/element.rb
CHANGED
@@ -7,6 +7,9 @@ require 'json'
|
|
7
7
|
require 'securerandom'
|
8
8
|
|
9
9
|
module Live
|
10
|
+
class PageError < RuntimeError
|
11
|
+
end
|
12
|
+
|
10
13
|
# Represents a single dynamic content area on the page.
|
11
14
|
class Element
|
12
15
|
def self.unique_id
|
@@ -66,8 +69,13 @@ module Live
|
|
66
69
|
# @parameter method [Symbol] The name of the remote functio to invoke.
|
67
70
|
# @parameter arguments [Array]
|
68
71
|
def rpc(*arguments)
|
69
|
-
|
70
|
-
|
72
|
+
if @page
|
73
|
+
# This update might not be sent right away. Therefore, mutable arguments may be serialized to JSON at a later time (or never). This could be a race condition:
|
74
|
+
@page.updates.enqueue(arguments)
|
75
|
+
else
|
76
|
+
# This is a programming error, as it probably means the element is still part of the logic of the server side (e.g. async loop), but it is not bound to a page, so there is nothing to update/access/rpc.
|
77
|
+
raise PageError, "Element is not bound to a page, make sure to implement #close!"
|
78
|
+
end
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
data/lib/live/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|