Sha256: b329004b98178a8999fc65c784cfaccf5f2921404bea856fa3982d7dd9b0fd9c

Contents?: true

Size: 838 Bytes

Versions: 16

Compression:

Stored size: 838 Bytes

Contents

class Cistern::String
  def self.camelize(string)
    string.gsub(/[A-Z]+/) { |w| "_#{w.downcase}" }.gsub(/^_/, "")
  end

  # File activesupport/lib/active_support/inflector/methods.rb, line 90
  def self.underscore(camel_cased_word)
    word = camel_cased_word.to_s.gsub('::', '/')
    #word.gsub!(/(?:([A-Za-z\d])|^)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1}#{$1 && '_'}#{$2.downcase}" }
    word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
    word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
    word.tr!("-", "_")
    word.downcase!
    word
  end

  # File activesupport/lib/active_support/inflector/methods.rb, line 168
  def self.demodulize(path)
    path = path.to_s
    if i = path.rindex('::')
      path[(i+2)..-1]
    else
      path
    end
  end

  # @todo omg so bad
  def self.pluralize(string)
    "#{string}s"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cistern-2.2.3 lib/cistern/string.rb
cistern-2.2.1 lib/cistern/string.rb
cistern-2.1.0 lib/cistern/string.rb
cistern-2.0.5 lib/cistern/string.rb
cistern-2.0.4 lib/cistern/string.rb
cistern-2.0.3 lib/cistern/string.rb
cistern-2.0.2 lib/cistern/string.rb
cistern-2.0.1 lib/cistern/string.rb
cistern-1.0.1.pre6 lib/cistern/string.rb
cistern-1.0.1.pre5 lib/cistern/string.rb
cistern-1.0.1.pre4 lib/cistern/string.rb
cistern-1.0.1.pre3 lib/cistern/string.rb
cistern-1.0.1.pre2 lib/cistern/string.rb
cistern-1.0.1.pre1 lib/cistern/string.rb
cistern-1.0.0.pre lib/cistern/string.rb
cistern-0.11.2.pre2 lib/cistern/string.rb