phlex 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of phlex might be problematic. Click here for more details.

data/lib/phlex/svg.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlex
4
+ class SVG < SGML
5
+ include StandardElements
6
+
7
+ def template
8
+ yield
9
+ end
10
+ end
11
+ end
@@ -1,19 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex
4
- module Testing
5
- module ViewHelper
6
- def render(view, &block)
7
- if view.is_a?(Class) && view < Phlex::HTML
8
- view = view.new
9
- end
10
-
11
- view.call(view_context: view_context, &block)
3
+ module Phlex::Testing
4
+ module ViewHelper
5
+ def render(view, &block)
6
+ if view.is_a?(Class) && view < Phlex::SGML
7
+ view = view.new
12
8
  end
13
9
 
14
- def view_context
15
- nil
16
- end
10
+ view.call(view_context: view_context, &block)
11
+ end
12
+
13
+ def view_context
14
+ nil
17
15
  end
18
16
  end
19
17
  end
@@ -1,51 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex
4
- class Unbuffered < BasicObject
5
- def initialize(object)
6
- @object = object
7
- end
8
-
9
- def inspect
10
- "Unbuffered(#{@object.class.name})[object: #{@object.inspect}]"
11
- end
3
+ class Phlex::Unbuffered < BasicObject
4
+ def initialize(object)
5
+ @object = object
6
+ end
12
7
 
13
- # Borrow some important methods from Object
14
- define_method :__class__,
15
- ::Object.instance_method(:class)
8
+ def inspect
9
+ "Unbuffered(#{@object.class.name})[object: #{@object.inspect}]"
10
+ end
16
11
 
17
- define_method :__public_send__,
18
- ::Object.instance_method(:public_send)
12
+ # Borrow some important methods from Object
13
+ define_method :__class__,
14
+ ::Object.instance_method(:class)
19
15
 
20
- def respond_to_missing?(...)
21
- @object.respond_to?(...)
22
- end
16
+ define_method :__public_send__,
17
+ ::Object.instance_method(:public_send)
23
18
 
24
- def method_missing(name, *args, **kwargs, &block)
25
- if @object.respond_to?(name)
19
+ def respond_to_missing?(...)
20
+ @object.respond_to?(...)
21
+ end
26
22
 
27
- __class__.define_method(name) do |*a, **k, &b|
28
- @object.capture { @object.public_send(name, *a, **k, &b) }
29
- end
23
+ def method_missing(name, *args, **kwargs, &block)
24
+ if @object.respond_to?(name)
30
25
 
31
- # Now we've defined this missing method, we can call it.
32
- __public_send__(name, *args, **kwargs, &block)
33
- else
34
- super
26
+ __class__.define_method(name) do |*a, **k, &b|
27
+ @object.capture { @object.public_send(name, *a, **k, &b) }
35
28
  end
36
- end
37
29
 
38
- # Forward some methods to the original underlying method
39
- def call(...)
40
- @object.call(...)
30
+ # Now we've defined this missing method, we can call it.
31
+ __public_send__(name, *args, **kwargs, &block)
32
+ else
33
+ super
41
34
  end
35
+ end
42
36
 
43
- def send(...)
44
- @object.send(...)
45
- end
37
+ # Forward some methods to the original underlying method
38
+ def call(...)
39
+ @object.call(...)
40
+ end
46
41
 
47
- def public_send(...)
48
- @object.public_send(...)
49
- end
42
+ def send(...)
43
+ @object.send(...)
44
+ end
45
+
46
+ def public_send(...)
47
+ @object.public_send(...)
50
48
  end
51
49
  end
data/lib/phlex/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex
4
- VERSION = "1.3.3"
4
+ VERSION = "1.4.0"
5
5
  end
data/lib/phlex.rb CHANGED
@@ -6,7 +6,11 @@ require "concurrent"
6
6
 
7
7
  module Phlex
8
8
  Loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false).tap do |loader|
9
- loader.inflector.inflect("html" => "HTML")
9
+ loader.inflector.inflect(
10
+ "html" => "HTML",
11
+ "svg" => "SVG",
12
+ "sgml" => "SGML"
13
+ )
10
14
  loader.ignore("#{__dir__}/phlex/testing")
11
15
  loader.setup
12
16
  end
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.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-11 00:00:00.000000000 Z
11
+ date: 2023-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -59,10 +59,8 @@ files:
59
59
  - fixtures/layout.rb
60
60
  - fixtures/page.rb
61
61
  - fixtures/view_helper.rb
62
- - lib/overrides/symbol/name.rb
63
62
  - lib/phlex.rb
64
63
  - lib/phlex/black_hole.rb
65
- - lib/phlex/buffered.rb
66
64
  - lib/phlex/callable.rb
67
65
  - lib/phlex/deferred_render.rb
68
66
  - lib/phlex/elements.rb
@@ -70,6 +68,10 @@ files:
70
68
  - lib/phlex/html.rb
71
69
  - lib/phlex/html/standard_elements.rb
72
70
  - lib/phlex/html/void_elements.rb
71
+ - lib/phlex/overrides/symbol/name.rb
72
+ - lib/phlex/sgml.rb
73
+ - lib/phlex/svg.rb
74
+ - lib/phlex/svg/standard_elements.rb
73
75
  - lib/phlex/testing/view_helper.rb
74
76
  - lib/phlex/unbuffered.rb
75
77
  - lib/phlex/version.rb
@@ -99,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
101
  - !ruby/object:Gem::Version
100
102
  version: '0'
101
103
  requirements: []
102
- rubygems_version: 3.5.6
104
+ rubygems_version: 3.4.6
103
105
  signing_key:
104
106
  specification_version: 4
105
107
  summary: A framework for building views in Ruby.
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "delegate"
4
-
5
- module Phlex
6
- class Buffered < SimpleDelegator
7
- def initialize(object, buffer:)
8
- super(object)
9
- @buffer = buffer
10
- end
11
-
12
- # Alias output methods to this
13
- def __output_method__(...)
14
- output = __getobj__.public_send(__callee__, ...)
15
- @buffer << output if output.is_a? String
16
- nil
17
- end
18
- end
19
- end