Sha256: b990a583b2de7b4049cf106b00e5fa80d4253ba6a23226fd0d57e63629c4af0f

Contents?: true

Size: 319 Bytes

Versions: 10

Compression:

Stored size: 319 Bytes

Contents

class Util
  def self.underscore(term)
    # taken from ActiveSupport
    term.gsub!(/::/, '/')
    term.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    term.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
    term.tr!('-', '_')
    term.downcase
  end

  def self.classify(term)
    term.split('_').collect(&:capitalize).join
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
orats-5.2.2 lib/orats/util.rb
orats-5.2.1 lib/orats/util.rb
orats-5.2.0 lib/orats/util.rb
orats-5.1.2 lib/orats/util.rb
orats-5.1.1 lib/orats/util.rb
zoku-0.0.1 lib/zoku/util.rb
orats-5.0.3 lib/orats/util.rb
orats-5.0.2 lib/orats/util.rb
orats-5.0.1 lib/orats/util.rb
orats-5.0.0 lib/orats/util.rb