Sha256: dbf24bade31ccd51e84be007ffe13509283f01164c37b3198bf969bee01b0178
Contents?: true
Size: 744 Bytes
Versions: 13
Compression:
Stored size: 744 Bytes
Contents
# frozen_string_literal: true module ActionPolicy module Ext # Add Module#namespace method module ModuleNamespace # :nodoc: all unless "".respond_to?(:safe_constantize) require "action_policy/ext/string_constantize" using ActionPolicy::Ext::StringConstantize end module Ext def namespace return unless name&.match?(/[^^]::/) name.sub(/::[^:]+$/, "").safe_constantize end end # See https://github.com/jruby/jruby/issues/5220 ::Module.include(Ext) if RUBY_PLATFORM.match?(/java/i) refine Module do if RUBY_VERSION <= "2.7.0" include Ext else import_methods Ext end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems