Sha256: 819355410a52292ea420032bab351a37aef27a769fb071713272d2acf0eed424

Contents?: true

Size: 263 Bytes

Versions: 3

Compression:

Stored size: 263 Bytes

Contents

class String
  def danger_class
    split('_').collect!(&:capitalize).join
  end

  def danger_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

3 entries across 3 versions & 1 rubygems

Version Path
danger-0.7.2 lib/danger/core_ext/string.rb
danger-0.7.1 lib/danger/core_ext/string.rb
danger-0.7.0 lib/danger/core_ext/string.rb