Sha256: 4054399110338a334293ff5f93d65308465fef9f001d545721dffcd7ea4b562c
Contents?: true
Size: 653 Bytes
Versions: 9
Compression:
Stored size: 653 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 include Ext end end end end
Version data entries
9 entries across 9 versions & 1 rubygems