Sha256: 637137c117a3b3756046683c7eb48b3e8fb3a58e418754d53b34b43d4ae05d49
Contents?: true
Size: 671 Bytes
Versions: 8
Compression:
Stored size: 671 Bytes
Contents
class Mustache module Utils class String def initialize string @string = string end def classify @string.split('/').map do |namespace| namespace.split(/[-_]/).map do |part| part[0] = part.chars.first.upcase part end.join end.join('::') end def underscore(view_namespace) @string .dup .split("#{view_namespace}::") .last .split('::') .map do |part| part[0] = part[0].downcase part.gsub(/[A-Z]/) { |s| "_" << s.downcase } end .join('/') end end end end
Version data entries
8 entries across 8 versions & 2 rubygems