Sha256: 69502d697d9bf90474578c6b0a5f7f04286101c0c0464fda7dc0834585842a6c
Contents?: true
Size: 435 Bytes
Versions: 29
Compression:
Stored size: 435 Bytes
Contents
# This extends String to add the +resourcerize+ method. class String # Dasherizes and downcases a camelcased string. Used for Feed types. def resourcerize self.gsub(/([a-z])([A-Z])/, '\1-\2').downcase end def constantize unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self raise NameError, "#{self.inspect} is not a valid constant name!" end Object.module_eval("::#{$1}", __FILE__, __LINE__) end end
Version data entries
29 entries across 29 versions & 4 rubygems