lib/surrogate/endower.rb in surrogate-0.3.0 vs lib/surrogate/endower.rb in surrogate-0.3.1

- old
+ new

@@ -1,19 +1,19 @@ class Surrogate # Adds surrogate behaviour to your class / singleton class / instances # - # please refactor me! + # please refactor me! ...may not be possible :( class Endower - def self.endow(klass, &playlist) - new(klass, &playlist).endow + def self.endow(klass, &block) + new(klass, &block).endow end - attr_accessor :klass, :playlist + attr_accessor :klass, :block - def initialize(klass, &playlist) - self.klass, self.playlist = klass, playlist + def initialize(klass, &block) + self.klass, self.block = klass, block end def endow endow_klass endow_singleton_class @@ -31,10 +31,10 @@ end def endow_singleton_class hatchery = add_hatchery_to singleton enable_defining_methods singleton - singleton.module_eval &playlist if playlist + singleton.module_eval &block if block klass.instance_variable_set :@hatchling, Hatchling.new(klass, hatchery) klass end # yeesh :( pretty sure there isn't a better way to do this