Sha256: 359d13e3f1f6fa903b8922e5b382fd8060735f822bb9b2e2093e6963d5287652
Contents?: true
Size: 732 Bytes
Versions: 2
Compression:
Stored size: 732 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 # 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open_namespace-0.3.1 | lib/open_namespace/open_namespace.rb |
open_namespace-0.3.0 | lib/open_namespace/open_namespace.rb |