live 0.8.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/live/version.rb +1 -1
- data/lib/live/view.rb +22 -6
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: e77327d7651ba96f1312740085897ec0f53430957dacb2d99782d895bf663afc
|
4
|
+
data.tar.gz: 4436c155cd68f013986e86da07af57af4238522fc18e8d9161720abe0d47d5ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a8160a7a68a5cc3ca5d4a00c350cd3147ba583f839fe395f73c1956ae918b2b00b3316067c633a434cc4e13472588caf2ffe4ec5f5d2ba39dd70bdbf8adbf0f
|
7
|
+
data.tar.gz: 0b623c52f0408c34eb09d16c5f3b25a609537fa55cb1771c92fa8092ab33baa31c8aeb3596150c014824a8a605b52c7b0630c5b2d80fea94e595d5d7935e53fd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/live/version.rb
CHANGED
data/lib/live/view.rb
CHANGED
@@ -9,6 +9,10 @@ require 'xrb/builder'
|
|
9
9
|
module Live
|
10
10
|
# Represents a single division of content on the page an provides helpers for rendering the content.
|
11
11
|
class View < Element
|
12
|
+
def script(code, **options)
|
13
|
+
rpc(:script, @id, code, options)
|
14
|
+
end
|
15
|
+
|
12
16
|
# Update the content of the client-side element by rendering this view.
|
13
17
|
def update!(**options)
|
14
18
|
rpc(:update, @id, self.to_html, options)
|
@@ -17,22 +21,28 @@ module Live
|
|
17
21
|
# Replace the content of the client-side element by rendering this view.
|
18
22
|
# @parameter selector [String] The CSS selector to replace.
|
19
23
|
# @parameter node [String] The HTML to replace.
|
20
|
-
def replace(selector,
|
21
|
-
|
24
|
+
def replace(selector, fragment = nil, **options, &block)
|
25
|
+
fragment ||= XRB::Builder.fragment(&block)
|
26
|
+
|
27
|
+
rpc(:replace, selector, fragment.to_s, options)
|
22
28
|
end
|
23
29
|
|
24
30
|
# Prepend to the content of the client-side element by appending the specified element.
|
25
31
|
# @parameter selector [String] The CSS selector to prepend to.
|
26
32
|
# @parameter node [String] The HTML to prepend.
|
27
|
-
def prepend(selector,
|
28
|
-
|
33
|
+
def prepend(selector, fragment = nil, **options, &block)
|
34
|
+
fragment ||= XRB::Builder.fragment(&block)
|
35
|
+
|
36
|
+
rpc(:prepend, selector, fragment.to_s, options)
|
29
37
|
end
|
30
38
|
|
31
39
|
# Append to the content of the client-side element by appending the specified element.
|
32
40
|
# @parameter selector [String] The CSS selector to append to.
|
33
41
|
# @parameter node [String] The HTML to prepend.
|
34
|
-
def append(selector,
|
35
|
-
|
42
|
+
def append(selector, fragment = nil, **options, &block)
|
43
|
+
fragment ||= XRB::Builder.fragment(&block)
|
44
|
+
|
45
|
+
rpc(:append, selector, fragment.to_s, options)
|
36
46
|
end
|
37
47
|
|
38
48
|
# Remove the specified element from the client-side element.
|
@@ -58,5 +68,11 @@ module Live
|
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
71
|
+
|
72
|
+
# Convenience method for rendering the view as a string.
|
73
|
+
# @returns [String] The generated HTML.
|
74
|
+
def to_s
|
75
|
+
to_html.to_s
|
76
|
+
end
|
61
77
|
end
|
62
78
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
39
39
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
40
40
|
-----END CERTIFICATE-----
|
41
|
-
date: 2024-05-
|
41
|
+
date: 2024-05-12 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: async-websocket
|
metadata.gz.sig
CHANGED
Binary file
|