live 0.14.0 → 0.16.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/element.rb +23 -5
- data/lib/live/version.rb +1 -1
- data/lib/live/view.rb +3 -5
- data.tar.gz.sig +0 -0
- metadata +7 -7
- 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: 960ab85523261e6aed7869a0bdaf9d0287b78a1582f7a45ed5d7de9d664fb1bb
|
4
|
+
data.tar.gz: '0848d0c2cc6c14702eb886a7eb719bf81e15e51f52b8500e736602743860213c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1822962cb839eac75ae7cef53abd80d3ede0bfb12d0844520aa1862328c0be64ea77df95388f12acb4d29b19005a872df7d008d50582ea28c6e22ba291063e
|
7
|
+
data.tar.gz: d4450a385662da48c87b2ed7f586ade4b44f2019889bf62a883edfedcf61a6397b44e7430e3a1a089e689558950d27027b4244932f4d252d99d793987f2ed54a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/live/element.rb
CHANGED
@@ -16,18 +16,30 @@ module Live
|
|
16
16
|
SecureRandom.uuid
|
17
17
|
end
|
18
18
|
|
19
|
+
# Mount an element within a parent element.
|
19
20
|
def self.mount(parent, id, data = {})
|
20
21
|
full_id = parent.id + ":" + id
|
21
22
|
|
22
23
|
self.new(full_id, data)
|
23
24
|
end
|
24
25
|
|
26
|
+
# Create a new element with a convenient syntax for specifying the id and data.
|
27
|
+
#
|
25
28
|
# @parameter id [String] The unique identifier within the page.
|
26
29
|
# @parameter data [Hash] The data associated with the element, typically stored as `data-` attributes.
|
27
|
-
def
|
30
|
+
def self.[](id = self.unique_id, **data)
|
31
|
+
self.new(id, data)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initialize the element with the specified id and data.
|
35
|
+
#
|
36
|
+
# @parameter id [String] The unique identifier within the page.
|
37
|
+
# @parameter data [Hash] The data associated with the element, typically stored as `data-` attributes.
|
38
|
+
def initialize(id = self.class.unique_id, data = {})
|
39
|
+
data[:class] ||= self.class.name
|
40
|
+
|
28
41
|
@id = id
|
29
42
|
@data = data
|
30
|
-
@data[:class] ||= self.class.name
|
31
43
|
@page = nil
|
32
44
|
end
|
33
45
|
|
@@ -138,11 +150,17 @@ module Live
|
|
138
150
|
builder.text(self.class.name)
|
139
151
|
end
|
140
152
|
|
153
|
+
def append_markup(output)
|
154
|
+
build_markup(::XRB::Builder.new(output))
|
155
|
+
end
|
156
|
+
|
157
|
+
def build_markup(builder)
|
158
|
+
render(builder)
|
159
|
+
end
|
160
|
+
|
141
161
|
# @returns [Object] The generated HTML.
|
142
162
|
def to_html
|
143
|
-
XRB::Builder.fragment
|
144
|
-
render(builder)
|
145
|
-
end
|
163
|
+
XRB::Builder.fragment(&self.method(:build_markup))
|
146
164
|
end
|
147
165
|
|
148
166
|
# Convenience method for rendering the view as a string.
|
data/lib/live/version.rb
CHANGED
data/lib/live/view.rb
CHANGED
@@ -10,11 +10,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
12
|
# @returns [Object] The generated HTML.
|
13
|
-
def
|
14
|
-
|
15
|
-
builder
|
16
|
-
render(builder)
|
17
|
-
end
|
13
|
+
def build_markup(builder)
|
14
|
+
builder.inline_tag :div, id: @id, class: "live", data: @data do
|
15
|
+
render(builder)
|
18
16
|
end
|
19
17
|
end
|
20
18
|
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.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -39,7 +39,7 @@ cert_chain:
|
|
39
39
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
40
40
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
41
41
|
-----END CERTIFICATE-----
|
42
|
-
date: 2024-
|
42
|
+
date: 2024-11-24 00:00:00.000000000 Z
|
43
43
|
dependencies:
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: async-websocket
|
@@ -73,16 +73,16 @@ dependencies:
|
|
73
73
|
name: xrb
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
78
|
+
version: '0.10'
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - "
|
83
|
+
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
85
|
+
version: '0.10'
|
86
86
|
description:
|
87
87
|
email:
|
88
88
|
executables: []
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.5.
|
121
|
+
rubygems_version: 3.5.22
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Live HTML tags updated via a WebSocket.
|
metadata.gz.sig
CHANGED
Binary file
|