Skip to content

Commit

Permalink
Simplify 2.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Jan 30, 2024
1 parent 3ffa190 commit f50a5e8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
9 changes: 8 additions & 1 deletion lib/phlex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Phlex
autoload :SGML, "phlex/sgml"
autoload :SVG, "phlex/svg"
autoload :Unbuffered, "phlex/unbuffered"
autoload :Overrides, "phlex/overrides"

# Included in all Phlex exceptions allowing you to match any Phlex error.
# @example Rescue any Phlex error:
Expand All @@ -33,3 +32,11 @@ class NameError < ::NameError
# @api private
ATTRIBUTE_CACHE = Concurrent::Map.new
end

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
class Symbol
def name
to_s
end
end
end
4 changes: 0 additions & 4 deletions lib/phlex/elements.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
using Phlex::Overrides::Symbol::Name
end

# Extending this module provides the {register_element} macro for registering your own custom elements. It's already extended by {HTML} and {SVG}.
# @example
# module MyCustomElements
Expand Down
4 changes: 0 additions & 4 deletions lib/phlex/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
using Phlex::Overrides::Symbol::Name
end

module Phlex::Helpers
private

Expand Down
11 changes: 0 additions & 11 deletions lib/phlex/overrides.rb

This file was deleted.

4 changes: 0 additions & 4 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
using Phlex::Overrides::Symbol::Name
end

module Phlex
# **Standard Generalized Markup Language** for behaviour common to {HTML} and {SVG}.
class SGML
Expand Down

0 comments on commit f50a5e8

Please sign in to comment.