Sha256: f941049dd34d98b8599911d0cf67ef0d3d94dab8da56f7081db1e24b9f1dbf6a
Contents?: true
Size: 401 Bytes
Versions: 12
Compression:
Stored size: 401 Bytes
Contents
# frozen_string_literal: true RubyNext::Core.patch Integer.singleton_class, method: :try_convert, singleton: Integer, version: "3.1" do <<-'RUBY' def try_convert(val) return val if val.is_a?(Integer) if val.respond_to?(:to_int) val.to_int.tap do |res| next if res.is_a?(Integer) || res.nil? raise TypeError, "Can't convert #{res.class} to Integer" end end end RUBY end
Version data entries
12 entries across 12 versions & 1 rubygems