phlex 1.3.0 → 1.3.1
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
- data/lib/phlex/html.rb +16 -0
- data/lib/phlex/unbuffered.rb +1 -11
- data/lib/phlex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cd9fd26d33fcf92978a26d9d94b81485871fa3f54c98639eb4ba5932960df84
|
|
4
|
+
data.tar.gz: c8f0ded1ee9cd43c12e8358af687b7fe4f21e732031ca4fb009020dfaaeb72b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 890ccb499d210d332f5b2213bfdce51bd1e2212c550b20b0d9de3d1698205ca45b82e86e7850dc037e07a43e3da70a011e27d2310618f203882a00b32750704d
|
|
7
|
+
data.tar.gz: fd9794d862a27ddaafa53c1f0d5fcecd3a967391083e2073922a2e83cbc19db7f95f4d19dd5db64b3c186e5c1c6292a6cef71dc05842c7216bd1e9b07046edc8
|
data/lib/phlex/html.rb
CHANGED
|
@@ -126,6 +126,8 @@ module Phlex
|
|
|
126
126
|
|
|
127
127
|
EVENT_ATTRIBUTES = %w[onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay oncanplaythrough onchange onclick oncontextmenu oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onerror onfocus onhashchange oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onmessage onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onoffline ononline onpagehide onpageshow onpaste onpause onplay onplaying onpopstate onprogress onratechange onreset onresize onscroll onsearch onseeked onseeking onselect onstalled onstorage onsubmit onsuspend ontimeupdate ontoggle onunload onvolumechange onwaiting onwheel].to_h { [_1, true] }.freeze
|
|
128
128
|
|
|
129
|
+
UNBUFFERED_MUTEX = Mutex.new
|
|
130
|
+
|
|
129
131
|
extend Elements
|
|
130
132
|
include Helpers
|
|
131
133
|
|
|
@@ -149,6 +151,16 @@ module Phlex
|
|
|
149
151
|
alias_method :__attributes__, :__final_attributes__
|
|
150
152
|
alias_method :call, :__final_call__
|
|
151
153
|
end
|
|
154
|
+
|
|
155
|
+
def __unbuffered_class__
|
|
156
|
+
UNBUFFERED_MUTEX.synchronize do
|
|
157
|
+
if defined? @unbuffered_class
|
|
158
|
+
@unbuffered_class
|
|
159
|
+
else
|
|
160
|
+
@unbuffered_class = Class.new(Unbuffered)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
152
164
|
end
|
|
153
165
|
|
|
154
166
|
def call(...)
|
|
@@ -272,6 +284,10 @@ module Phlex
|
|
|
272
284
|
@_target = original_buffer
|
|
273
285
|
end
|
|
274
286
|
|
|
287
|
+
def unbuffered
|
|
288
|
+
self.class.__unbuffered_class__.new(self)
|
|
289
|
+
end
|
|
290
|
+
|
|
275
291
|
# Like `capture` but the output is vanished into a BlackHole buffer.
|
|
276
292
|
# Becuase the BlackHole does nothing with the output, this should be faster.
|
|
277
293
|
private def __vanish__(*args)
|
data/lib/phlex/unbuffered.rb
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module Phlex
|
|
4
4
|
class Unbuffered < BasicObject
|
|
5
|
-
CACHE = ::Concurrent::Map.new
|
|
6
|
-
|
|
7
|
-
def self.call(object)
|
|
8
|
-
decorator = CACHE.compute_if_absent(object.class.name) { ::Class.new(self) }
|
|
9
|
-
decorator.new(object)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
5
|
def initialize(object)
|
|
13
6
|
@object = object
|
|
14
7
|
end
|
|
@@ -24,9 +17,6 @@ module Phlex
|
|
|
24
17
|
define_method :__public_send__,
|
|
25
18
|
::Object.instance_method(:public_send)
|
|
26
19
|
|
|
27
|
-
define_method :__callee__,
|
|
28
|
-
::Object.instance_method(:__callee__)
|
|
29
|
-
|
|
30
20
|
def respond_to_missing?(...)
|
|
31
21
|
@object.respond_to?(...)
|
|
32
22
|
end
|
|
@@ -39,7 +29,7 @@ module Phlex
|
|
|
39
29
|
end
|
|
40
30
|
|
|
41
31
|
# Now we've defined this missing method, we can call it.
|
|
42
|
-
__public_send__(name, *args, &block)
|
|
32
|
+
__public_send__(name, *args, **kwargs, &block)
|
|
43
33
|
else
|
|
44
34
|
super
|
|
45
35
|
end
|
data/lib/phlex/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joel Drapper
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-01-
|
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|