about summary refs log tree commit homepage
path: root/lib/dtas.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-01-20 18:34:17 +0000
committerEric Wong <e@80x24.org>2022-01-21 19:54:42 +0000
commit5111742a5a100e44fccf191b12a13c452b025944 (patch)
tree94c2e66a90425d80f937491e86cd3adfcc4eba84 /lib/dtas.rb
parentc3b34b1693e7b35841d87dae0dce8ccecebe9008 (diff)
downloaddtas-5111742a5a100e44fccf191b12a13c452b025944.tar.gz
Ruby 2.3+ supports String#@-, though it did not deduplicate
strings.  But 2.5 is already old at this point and most users
can be expected to have it.

This gives some memory regressions for Ruby <= 2.4 users,
but cuts down on the code we maintain and reduces bytecode
overhead for 2.5+ users.
Diffstat (limited to 'lib/dtas.rb')
-rw-r--r--lib/dtas.rb13
1 files changed, 0 insertions, 13 deletions
diff --git a/lib/dtas.rb b/lib/dtas.rb
index eb8f49d..477a176 100644
--- a/lib/dtas.rb
+++ b/lib/dtas.rb
@@ -25,19 +25,6 @@ module DTAS
       Fiddle.dlopen(nil)
     end
   end
-
-  # String#-@ will deduplicate strings when Ruby 2.5 is released (Dec 2017)
-  # https://bugs.ruby-lang.org/issues/13077
-  if RUBY_VERSION.to_f >= 2.5
-    def self.dedupe_str(str)
-      -str
-    end
-  else
-    # Ruby 2.1 - 2.4, noop for older Rubies
-    def self.dedupe_str(str)
-      eval "#{str.inspect}.freeze"
-    end
-  end
   # :startdoc:
 end