Permalink
Browse files

Refactor next_in_flow frontend.

  • Loading branch information...
jcoglan committed Jul 13, 2010
1 parent e38aaba commit 98681c3f89bbca4b01c1a6dd129ae7265fe153e8
Showing with 4 additions and 17 deletions.
  1. +1 −1 lib/action_flow.rb
  2. +1 −10 lib/action_flow/filters.rb
  3. +1 −1 lib/action_flow/flow/controller.rb
  4. +1 −5 lib/action_flow/helpers.rb
View
@@ -4,8 +4,8 @@
flow
flow/controller
flow/state
- filters
helpers
+ filters
].each do |file|
require File.dirname(__FILE__) + '/action_flow/' + file
end
View
@@ -3,23 +3,14 @@
module ActionFlow
module Filters
- extend Forwardable
- def_delegators :flow_controller, :in_flow?, :in_any_flow?
+ include Helpers
def self.included(klass)
klass.before_filter :update_flow_status
end
private
- def flow_controller
- @flow_controller ||= Flow::Controller.new(self)
- end
-
- def next_in_flow(name = nil, params = {})
- flow_controller.pick_next_action(name, params)
- end
-
def flow(name = nil)
flow_state = name.nil? ? flow_controller.current_flow : flow_controller.status[name]
flow_state.variables
@@ -40,7 +40,7 @@ def update_session!
dump_states_to_session!
end
- def pick_next_action(*args)
+ def next_in_flow(*args)
flow_name = args.find { |arg| Symbol === arg } || nil
params = args.find { |arg| Hash === arg } || {}
@@ -4,11 +4,7 @@ module ActionFlow
module Helpers
extend Forwardable
- def_delegators :flow_controller, :in_flow?, :in_any_flow?
-
- def next_in_flow(name = nil, params = {})
- flow_controller.pick_next_action(name, params)
- end
+ def_delegators :flow_controller, :in_flow?, :in_any_flow?, :next_in_flow
def flow_controller
@flow_controller ||= Flow::Controller.new(self)

0 comments on commit 98681c3

Please sign in to comment.