update old

This commit is contained in:
邱博亞 2022-08-04 17:02:03 +08:00
parent ff34b42e10
commit 0155a73f25
1 changed files with 41 additions and 0 deletions

View File

@ -20,12 +20,52 @@ if Rails.version.to_i>4
end
end
end
if RUBY_VERSION.to_f > 2.1
if RUBY_VERSION.to_f>2.4
module Psych
def self.load(yaml, permitted_classes: [Symbol], permitted_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false, freeze: false, strict_integer: false)
return self.unsafe_load(yaml, filename: filename, fallback: fallback, symbolize_names: symbolize_names, freeze: freeze, strict_integer: strict_integer)
end
end
end
class Time
def new_offset(offset)
DateTime.new(self.to_i).new_offset(offset)
end
end
class ActionController::Parameters
def any?(&block)
self.permit!.to_h.any?(&block)
end
end
module URI
def self.escape(uri)
self::DEFAULT_PARSER.escape(uri)
end
def self.unescape(uri)
self::DEFAULT_PARSER.unescape(uri)
end
def self.parse(uri)
uri = uri.strip
scheme, userinfo, host, port,
registry, path, opaque, query, fragment = self.split(uri)
if scheme && self.scheme_list.include?(scheme.upcase)
self.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
else
Generic.new(scheme, userinfo, host, port,
registry, path, opaque, query,
fragment, self)
end
end
class <<self
alias_method :encode, :escape
alias_method :decode, :unescape
end
end
end
if Mongoid::VERSION.to_i < 5
@ -118,6 +158,7 @@ module Mongoid
end
end
end
module ActionView::Helpers::AssetTagHelper
self.included do
def stylesheet_link_tag(*sources)