Sha256: 27ff207b16cf8c9c99d6f3c87ab2fd0546e50e3183e9fccd4da386115a5c9950

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

require 'rubygems'
require 'active_support'

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_with_attributes_query(meth, *args)
    fetch(meth) do
      method_missing_without_attributes_query(meth)
    end
  end
  alias_method_chain :method_missing, :attributes_query  
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

1 entries across 1 versions & 1 rubygems

Version Path
amazon-associates-0.6.3 lib/amazon-associates/extensions/core.rb