Sha256: dd60b3737ed525ff66b6ff00cd8e49dff407f85b3cb2f28aba62b5b121da2bdd

Contents?: true

Size: 253 Bytes

Versions: 15

Compression:

Stored size: 253 Bytes

Contents

class String
  def presence
    return nil if self.empty?
    self
  end
  def underscore
    self.gsub(/::/, '/').
        gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
        gsub(/([a-z\d])([A-Z])/,'\1_\2').
        tr("-", "_").
        downcase
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jeanine-0.8.1 lib/jeanine/core_ext/string.rb
jeanine-0.8 lib/jeanine/core_ext/string.rb
jeanine-0.7.8 lib/jeanine/core_ext/string.rb
jeanine-0.7.7 lib/jeanine/core_ext/string.rb
jeanine-0.7.6 lib/jeanine/core_ext/string.rb
jeanine-0.7.5 lib/jeanine/core_ext/string.rb
jeanine-0.7.4 lib/jeanine/core_ext/string.rb
jeanine-0.7.3.2 lib/jeanine/core_ext/string.rb
jeanine-0.7.3.1 lib/jeanine/core_ext/string.rb
jeanine-0.7.3 lib/jeanine/core_ext/string.rb
jeanine-0.7.2 lib/jeanine/core_ext/string.rb
jeanine-0.7.1 lib/jeanine/core_ext/string.rb
jeanine-0.7.0 lib/jeanine/core_ext/string.rb
jeanine-0.6.0 lib/jeanine/core_ext/string.rb
jeanine-0.5.0 lib/jeanine/core_ext/string.rb