Sha256: 4fc92fe55ab870a7358a24005705a54a0bddc3a1c3d1b83089063239d272fa21
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
require 'open_namespace/class_methods' module OpenNamespace def self.included(base) base.extend ClassMethods end # # Maps a constant name to a likely file path. # # @param [String, Symbol] name # The constant name. # # @return [String] # The file path that the constant is likely to be defined within. # # @since 0.3.0 # def OpenNamespace.constant_path(name) path = name.to_s.dup # back-ported from extlib's String#to_const_path path.gsub!(/::/,'/') # back-ported from extlib's String#snake_case unless path.match(/\A[A-Z]+\z/) path.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') path.gsub!(/([a-z])([A-Z])/, '\1_\2') end path.downcase! return path end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open_namespace-0.3.2 | lib/open_namespace/open_namespace.rb |