Sha256: 005f65225628a1832016624e34c0e2ce208cdcdaeb1f85629318421fd24c6227
Contents?: true
Size: 551 Bytes
Versions: 3
Compression:
Stored size: 551 Bytes
Contents
module Cell::Util def util Inflector end class Inflector # copied from ActiveSupport. def self.underscore(constant) constant.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end # WARNING: this API might change. def self.constant_for(name) constant = Object name.split("/").each do |part| constant = constant.const_get(part.split('_').collect(&:capitalize).join) end constant end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cells-4.1.1 | lib/cell/util.rb |
cells-4.1.0 | lib/cell/util.rb |
cells-4.1.0.rc1 | lib/cell/util.rb |