live 0.15.0 → 0.17.0

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: 35d2a64d31fa83855d4dd194f497ef9c948c9d03fde7fabf73256bdccec8d03e
4
- data.tar.gz: 161456e3ee4ded05ff1c6e58e81d78a098ed28a19d33d9da4217f2d4bc190db1
3
+ metadata.gz: 9e821b6c491dfd6033b870fa426fd43b0e0e14c3bb19d9a77796d991f3263c84
4
+ data.tar.gz: 529f78570c91e31ba58ad95651a534586c630e4f1cfd46fef05070bf544b161a
5
5
  SHA512:
6
- metadata.gz: ba9b1e779713e8330e440d1d3f3fbb67b4ef41708e0d549828790d135f4e7e80e4420292e923dad5941be0e9ff538c6184383600773490fd6ee36ec8e796228c
7
- data.tar.gz: f1f9df657949d4c56d5b99ccb2a280e4f9599d45152a1a96db3ca039401593d48df0fbe5e510d749f98e719b768fdd5fa9211bd58a25fa0c48e40b23fd137954
6
+ metadata.gz: 174e05351add100c37874f34e0527c331886c13a02144d98a558d51e48758f425403cd4855b43d0e801d006b8d27e9e73fa0df15bda1c2501cb500be013a87d1
7
+ data.tar.gz: eff442c283edf136bb43ee8fa0b5ce398fbb608a5f28ccc16fc9fcbe15be5d9b4cb5349835e6897e6002d312b99a0f95bc3f5ec604d1e01a28fa965c3c9de3b6
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- B���G��^Ub<Ƶ�vz ���A���/
2
- 2JQ��pJ��ukߑl�����ԭv8e8�L��9������;[n��[�=�H�m������1}����`Knv#�9��vu��.N�ܮ� �
3
- I]�����M 5���WЁ�QS9!�٬Nj�0Ӊcb��S{Fz�C���l�k�!O.aj���3�@S^ָ_�d��\ި]�ka1-�y�U�/�����sh�X����:����N�lڑ,�,$4b9 %���Py�Vf�=��*D�yN_��^�U��p��������m���d�”��,��aõ�iҋ����Q����u�<���x��}���v��@� ���M �
1
+ |�TD�ƹ0X2]��֍4�ޘ� c.c�&a��Q���%d:�
2
+ c-Z[���"���^<���g�b�T�2b��7RWE�^^ú��g�L�ȄlK�!�lW{ _���Ejz����DVI�!��/
3
+ _��J��{DU7i��e�)UfW����'JkƓ�cf�0�~|�yy�֔�Ɏ"
data/lib/live/element.rb CHANGED
@@ -16,18 +16,34 @@ module Live
16
16
  SecureRandom.uuid
17
17
  end
18
18
 
19
- def self.mount(parent, id, data = {})
19
+ # Create a new root element with a convenient syntax for specifying the id and data.
20
+ #
21
+ # @parameter id [String] The unique identifier within the page.
22
+ # @parameter data [Hash] The data associated with the element, typically stored as `data-` attributes.
23
+ def self.root(id = self.unique_id, **data)
24
+ self.new(id, data)
25
+ end
26
+
27
+ # Mount an element within a parent element.
28
+ def self.child(parent, id = self.unique_id, **data)
20
29
  full_id = parent.id + ":" + id
21
30
 
22
31
  self.new(full_id, data)
23
32
  end
24
33
 
34
+ def self.mount(parent, id, data = {})
35
+ self.child(parent, id, **data)
36
+ end
37
+
38
+ # Initialize the element with the specified id and data.
39
+ #
25
40
  # @parameter id [String] The unique identifier within the page.
26
41
  # @parameter data [Hash] The data associated with the element, typically stored as `data-` attributes.
27
- def initialize(id = Element.unique_id, data = {})
42
+ def initialize(id = self.class.unique_id, data = {})
43
+ data[:class] ||= self.class.name
44
+
28
45
  @id = id
29
46
  @data = data
30
- @data[:class] ||= self.class.name
31
47
  @page = nil
32
48
  end
33
49
 
data/lib/live/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2024, by Samuel Williams.
5
5
 
6
6
  module Live
7
- VERSION = "0.15.0"
7
+ VERSION = "0.17.0"
8
8
  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.15.0
4
+ version: 0.17.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-10-28 00:00:00.000000000 Z
42
+ date: 2024-11-24 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: async-websocket
@@ -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.11
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