Sha256: f5f2f2e956a815e04a683884eee010052e12129ae8d85a5cfdc935cc022bfb56

Contents?: true

Size: 398 Bytes

Versions: 45

Compression:

Stored size: 398 Bytes

Contents

module Enumerable
  def dups
    inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys
  end
end

class String
  # copy from rails
  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

class NilClass
  def method_missing(method_sym, *arguments, &block)
    return nil
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
rails_best_practices-0.4.2 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.4.1 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.4.0 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.27 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.26 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.25 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.24 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.23 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.22 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.21 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.20 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.19 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.18 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.17 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.16 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.15 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.14 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.13 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.12 lib/rails_best_practices/core/core_ext.rb
rails_best_practices-0.3.11 lib/rails_best_practices/core/core_ext.rb