Sha256: 68f52d5abb0499816406710f65585f0e3f1fcc876a4dfac7aafbf20fe75a7f9a
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
require "collection_extensions/version" require "collection_extensions/cattr" require "collection_extensions/config" module CollectionExtensions def self.included(base) base.extend ClassMethods end module ClassMethods def extend_collections(*associations) Array(associations).each do |association| alias_method "orig_#{association}", association define_method association do upper_camel = association.to_s.split("_").collect{|piece| piece.capitalize}.join extender = Object.const_get(CollectionExtensions::Config.naming_convention % upper_camel) send("orig_#{association}").extend(extender) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
collection_extensions-0.0.1 | lib/collection_extensions.rb |