From bb32281d2dfe7e1d2f6fba684fa8e913c5cdb025 Mon Sep 17 00:00:00 2001 From: Travis Tilley Date: Sun, 17 Jan 2010 01:30:38 -0500 Subject: [PATCH] whitespace ninja --- lib/aasm/aasm.rb | 14 ++++++------ lib/aasm/event.rb | 54 +++++++++++++++++++++++------------------------ lib/aasm/state.rb | 16 +++++++------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/aasm/aasm.rb b/lib/aasm/aasm.rb index 18989ffc..be6f090e 100644 --- a/lib/aasm/aasm.rb +++ b/lib/aasm/aasm.rb @@ -125,12 +125,12 @@ def aasm_current_state=(state) def aasm_determine_state_name(state) case state - when Symbol, String - state - when Proc - state.call(self) - else - raise NotImplementedError, "Unrecognized state-type given. Expected Symbol, String, or Proc." + when Symbol, String + state + when Proc + state.call(self) + else + raise NotImplementedError, "Unrecognized state-type given. Expected Symbol, String, or Proc." end end @@ -144,7 +144,7 @@ def aasm_fire_event(name, persist, *args) event = self.class.aasm_events[name] begin old_state = aasm_state_object_for_state(aasm_current_state) - + old_state.call_action(:exit, self) diff --git a/lib/aasm/event.rb b/lib/aasm/event.rb index 530a9156..22133ae3 100644 --- a/lib/aasm/event.rb +++ b/lib/aasm/event.rb @@ -50,19 +50,19 @@ def ==(event) end end - def update(options = {}, &block) - if options.key?(:success) then - @success = options[:success] - end - if options.key?(:error) then - @error = options[:error] - end - if block then - instance_eval(&block) - end - @options = options - self - end + def update(options = {}, &block) + if options.key?(:success) then + @success = options[:success] + end + if options.key?(:error) then + @error = options[:error] + end + if block then + instance_eval(&block) + end + @options = options + self + end def execute_success_callback(obj, success = nil) callback = success || @success @@ -76,21 +76,21 @@ def execute_success_callback(obj, success = nil) end end - def execute_error_callback(obj, error, error_callback=nil) - callback = error_callback || @error - raise error unless callback - case(callback) - when String, Symbol - raise NoMethodError unless obj.respond_to?(callback.to_sym) - obj.send(callback, error) - when Proc - callback.call(obj, error) - when Array - callback.each{|meth|self.execute_error_callback(obj, error, meth)} - end - end + def execute_error_callback(obj, error, error_callback=nil) + callback = error_callback || @error + raise error unless callback + case(callback) + when String, Symbol + raise NoMethodError unless obj.respond_to?(callback.to_sym) + obj.send(callback, error) + when Proc + callback.call(obj, error) + when Array + callback.each{|meth|self.execute_error_callback(obj, error, meth)} + end + end - private + private def _call_action(action, record) case action diff --git a/lib/aasm/state.rb b/lib/aasm/state.rb index 9b4b7cc4..df3840f7 100644 --- a/lib/aasm/state.rb +++ b/lib/aasm/state.rb @@ -14,14 +14,14 @@ def ==(state) end end - def call_action(action, record) - action = @options[action] - catch :halt_aasm_chain do - action.is_a?(Array) ? - action.each {|a| _call_action(a, record)} : - _call_action(action, record) - end - end + def call_action(action, record) + action = @options[action] + catch :halt_aasm_chain do + action.is_a?(Array) ? + action.each {|a| _call_action(a, record)} : + _call_action(action, record) + end + end def display_name @display_name ||= name.to_s.gsub(/_/, ' ').capitalize