Sha256: 4daabaa58a66c6c144734c63bd21a2f193466ddee5745604b43c85366fc7be89

Contents?: true

Size: 1.64 KB

Versions: 9

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby
#####################################################################################
# Copyright (c) 2011, Cohesive Flexible Technologies, Inc.
# This copyrighted material is the property of Cohesive Flexible Technologies and
# is subject to the license terms of the product it is contained within, whether 
# in text or compiled form.  It is licensed under the terms expressed in the 
# accompanying README and LICENSE files.
# 
# This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty 
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#####################################################################################

#####################################################################################
# Copyright (c) 2010, Cohesive Flexible Technologies, Inc.
# This copyrighted material is the property of Cohesive Flexible Technologies and
# is subject to the license terms of the product it is contained within, whether 
# in text or compiled form.  It is licensed under the terms expressed in the 
# accompanying README and LICENSE files.
# 
# This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty 
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#####################################################################################

class Hash
  def method_missing(meth, *args, &block)
    if args.size == 0
      dashed = meth.to_s.gsub(/_/, '-')
      self[meth] || self[dashed] || self[dashed.to_sym] || super(meth, *args, &block) rescue nil
    end
  end
end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cft_smartcloud-0.3.3 lib/hash_fix.rb
cft_smartcloud-0.3.2 lib/hash_fix.rb
cft_smartcloud-0.3.1 lib/hash_fix.rb
cft_smartcloud-0.3.0 lib/hash_fix.rb
cft_smartcloud-0.2.2 lib/hash_fix.rb
cft_smartcloud-0.1.9 lib/hash_fix.rb
cft_smartcloud-0.1.8 lib/hash_fix.rb
cft_smartcloud-0.1.5 lib/hash_fix.rb
cft_smartcloud-0.1.4 lib/hash_fix.rb