app/models/bit_player/navigator.rb in bit_player-0.1.3 vs app/models/bit_player/navigator.rb in bit_player-0.1.4

- old
+ new

@@ -1,8 +1,11 @@ module BitPlayer + # Business rules for proceeding statefully through an application. class Navigator - RenderOptions = Struct.new(:view_context, :app_context, :position, :participant) + RenderOptions = Struct.new( + :view_context, :app_context, :position, :participant + ) def initialize(participant) @participant = participant @status = participant.navigation_status end @@ -22,11 +25,13 @@ def content_position @status.content_position end def render_current_content(view_context) - options = RenderOptions.new(view_context, context, content_position, @participant) + options = RenderOptions.new( + view_context, context, content_position, @participant + ) current_content_provider.render_current(options) end def show_nav_link? @@ -53,13 +58,13 @@ def initialize_location(options) content_module = ContentModule.find(options[:module_id]) @status.context = content_module.context @status.module_position = content_module.position + @status.provider_position = 1 if options[:provider_id] - @status.provider_position = content_module.content_providers.find(options[:provider_id]).position - else - @status.provider_position = 1 + @status.provider_position = content_module.content_providers + .find(options[:provider_id]).position end @status.content_position = [options[:content_position].to_i, 1].max @status.save end