Sha256: 219f7f69ce756e2458659a7c4a344739a979e1c0cbac696e1285f638b548f942
Contents?: true
Size: 724 Bytes
Versions: 14
Compression:
Stored size: 724 Bytes
Contents
class Tram::Policy if Object.const_defined? "ActiveSupport::Inflector" # @private Inflector = ActiveSupport::Inflector elsif Object.const_defined? "Inflecto" # @private Inflector = ::Inflecto else # @private module Inflector def self.underscore(name) name&.dup&.tap do |n| n.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') n.gsub!(/([a-z\d])([A-Z])/, '\1_\2') n.gsub!("::", "/") n.tr!("-", "_") n.downcase! end end def self.camelize(name) name&.dup&.tap do |n| n.gsub!(/(?:\A|_+)(.)/) { $1.upcase } n.gsub!(%r{(?:[/|-]+)(.)}) { "::#{$1.upcase}" } end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems