Sha256: a1c70c551e5a12cbdb805de90cc7ea8da8e5aaec478341f2d369b8eee358dad3

Contents?: true

Size: 585 Bytes

Versions: 3

Compression:

Stored size: 585 Bytes

Contents

require 'active_support'
require 'active_support/core_ext/enumerable'

require 'active_model'

class Object # http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html
  def meta_def name, &blk
    (class << self; self; end).instance_eval { define_method name, &blk }
  end
end

class OpenHash < Hash
  def method_missing(meth, *args)
    fetch(meth) do
      super
    end
  end
end

class Float
  def whole?
    (self % 1) < 0.0001
  end
end

class Hash
  def rekey!(keys)
    keys.each_pair do |old, new|
      store(new, delete(old)) if has_key?(old)    
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
amazon-associates-0.7.2 lib/amazon-associates/extensions/core.rb
amazon-associates-0.7.1 lib/amazon-associates/extensions/core.rb
amazon-associates-0.7.0 lib/amazon-associates/extensions/core.rb