lib/innate/traited.rb in manveru-innate-2009.02.06 vs lib/innate/traited.rb in manveru-innate-2009.02.21

- old
+ new

@@ -1,14 +1,19 @@ module Innate module Traited - TRAITS = Hash.new{|h,k| h[k] = {}} + TRAITS = {} def self.included(into) into.extend(self) end def trait(hash = nil) - hash ? TRAITS[self].update(hash) : TRAITS[self] + if hash + TRAITS[self] ||= {} + TRAITS[self].merge!(hash) + else + TRAITS[self] || {} + end end def ancestral_trait ancs = respond_to?(:ancestors) ? ancestors : self.class.ancestors ancs.reverse.inject({}){|s,v|