lib/context/lifecycle.rb in jeremymcanally-context-0.0.5 vs lib/context/lifecycle.rb in jeremymcanally-context-0.0.6

- old
+ new

@@ -20,22 +20,22 @@ # def after(period = :each, &block) send("after_#{period}_callbacks") << block end - def gather_callbacks(callback_type, period) + def gather_callbacks(callback_type, period) # :nodoc: callbacks = superclass.respond_to?(:gather_callbacks) ? superclass.gather_callbacks(callback_type, period) : [] callbacks.push(*send("#{callback_type}_#{period}_callbacks")) end end self.before_all_callbacks = [] self.before_each_callbacks = [] self.after_each_callbacks = [] self.after_all_callbacks = [] - def self.inherited(child) + def self.inherited(child) # :nodoc: super child.before_all_callbacks = [] child.before_each_callbacks = [] child.after_each_callbacks = [] child.after_all_callbacks = [] @@ -49,22 +49,22 @@ run_each_callbacks :after end end end - def run_each_callbacks(callback_type) + def run_each_callbacks(callback_type) # :nodoc: self.class.gather_callbacks(callback_type, :each).each { |c| instance_eval(&c) } end - def run_all_callbacks(callback_type) + def run_all_callbacks(callback_type) # :nodoc: previous_ivars = instance_variables self.class.gather_callbacks(callback_type, :all).each { |c| instance_eval(&c) } (instance_variables - previous_ivars).inject({}) do |hash, ivar| hash.update ivar => instance_variable_get(ivar) end end - def set_values_from_callbacks(values) + def set_values_from_callbacks(values) # :nodoc: values.each do |name, value| instance_variable_set name, value end end end \ No newline at end of file