phlex 2.0.0.beta1 → 2.0.0.beta2

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: fd808f50305105b7fb8cde4624804427da99fa7a3e59a20f6442e1db35e0983d
4
- data.tar.gz: f3e7f7b703a27e3a00bbea42749e4682ac0255a3c3c12abca5c94f90de1be23c
3
+ metadata.gz: 46379514e0705957409d87f74668c2f012e03d5a48fe14f41b4100172b0672c0
4
+ data.tar.gz: c4ddfa6b1c8eabfc66534abb52ca6fbe543db4d41ddf529b50fc8d0cd3393f63
5
5
  SHA512:
6
- metadata.gz: d66595c47ec3704a3b06c619e2fe8697252a8e9f5566be7c0c8082c06c69a46361686135411f04268854a1a087a78b24e072e7ca4fa98fd23b64dfaa147f6f07
7
- data.tar.gz: e93c80673a2ca16d9585d76b8c348ec0a7ddf04013720d083dc064b432aaf7f1642bbe5a6b8622fea6c18eb453f663de0d36929bd903f3b40a7f243987a46dee
6
+ metadata.gz: 9aa416b84741e68ee9429b11c2cd2fc9dc2986ae4cc15eefff126b5f53e177aad9129cdc1349e827e54aef5c5a26f08f12017e3d200b98c5930130c4c13883fc
7
+ data.tar.gz: fc0cd1de6ab7d6a6f1b76447fad84a263c9cda0ce7e0a9f4313b579c38b7246a4704a02fd183bc0b29bdc171f374070aed0e0c2933f6e06388e58696f58f2565
@@ -6,9 +6,11 @@ module Phlex::ElementClobberingGuard
6
6
  if method_name[0] == "_" && __element_method__?(method_name[1..].to_sym)
7
7
  raise Phlex::NameError.new("👋 Redefining the method `#{name}##{method_name}` is not a good idea.")
8
8
  elsif method_name == :view_template
9
- Phlex.__expand_attribute_cache__(
10
- instance_method(method_name).source_location[0],
11
- )
9
+ location = instance_method(method_name).source_location[0]
10
+
11
+ if location[0] in "/" | "."
12
+ Phlex.__expand_attribute_cache__(location)
13
+ end
12
14
  else
13
15
  super
14
16
  end
@@ -64,23 +64,23 @@ module Phlex::Elements
64
64
  if original_length == buffer.bytesize
65
65
  case content
66
66
  when String
67
- buffer << Phlex::Escape.html_escape(content)
67
+ buffer << ::Phlex::Escape.html_escape(content)
68
68
  when Symbol
69
- buffer << Phlex::Escape.html_escape(content.name)
69
+ buffer << ::Phlex::Escape.html_escape(content.name)
70
70
  when nil
71
71
  nil
72
- when Phlex::SGML::SafeObject
72
+ when ::Phlex::SGML::SafeObject
73
73
  buffer << content.to_s
74
74
  else
75
75
  if (formatted_object = format_object(content))
76
- buffer << Phlex::Escape.html_escape(formatted_object)
76
+ buffer << ::Phlex::Escape.html_escape(formatted_object)
77
77
  end
78
78
  end
79
79
  end
80
80
 
81
81
  buffer << "</#{tag}>"
82
82
  else # without content
83
- buffer << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes] ||= __attributes__(attributes)) << "></#{tag}>"
83
+ buffer << "<#{tag}" << (::Phlex::ATTRIBUTE_CACHE[attributes] ||= __attributes__(attributes)) << "></#{tag}>"
84
84
  end
85
85
  else # without attributes
86
86
  if block_given # with content block
@@ -91,16 +91,16 @@ module Phlex::Elements
91
91
  if original_length == buffer.bytesize
92
92
  case content
93
93
  when String
94
- buffer << Phlex::Escape.html_escape(content)
94
+ buffer << ::Phlex::Escape.html_escape(content)
95
95
  when Symbol
96
- buffer << Phlex::Escape.html_escape(content.name)
96
+ buffer << ::Phlex::Escape.html_escape(content.name)
97
97
  when nil
98
98
  nil
99
- when Phlex::SGML::SafeObject
99
+ when ::Phlex::SGML::SafeObject
100
100
  buffer << content.to_s
101
101
  else
102
102
  if (formatted_object = format_object(content))
103
- buffer << Phlex::Escape.html_escape(formatted_object)
103
+ buffer << ::Phlex::Escape.html_escape(formatted_object)
104
104
  end
105
105
  end
106
106
  end
@@ -152,7 +152,7 @@ module Phlex::Elements
152
152
  end
153
153
 
154
154
  if attributes.length > 0 # with attributes
155
- buffer << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes] ||= __attributes__(attributes)) << ">"
155
+ buffer << "<#{tag}" << (::Phlex::ATTRIBUTE_CACHE[attributes] ||= __attributes__(attributes)) << ">"
156
156
  else # without attributes
157
157
  buffer << "<#{tag}>"
158
158
  end
data/lib/phlex/helpers.rb CHANGED
@@ -26,6 +26,8 @@ module Phlex::Helpers
26
26
  [old] + new.to_a
27
27
  in [String, String]
28
28
  "#{old} #{new}"
29
+ in [_, nil]
30
+ old
29
31
  else
30
32
  new
31
33
  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 = "2.0.0.beta1"
4
+ VERSION = "2.0.0.beta2"
5
5
  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: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-09-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A high-performance view framework optimised for fun.
14
14
  email: