Module: Crabfarm::Modes::Recorder::Snapshot

Extended by:
Snapshot
Included in:
Snapshot
Defined in:
lib/crabfarm/modes/recorder/snapshot.rb

Instance Method Summary collapse

Instance Method Details

#start(_context, _navigator, _query = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/crabfarm/modes/recorder/snapshot.rb', line 13

def start(_context, _navigator, _query=nil)
  return puts "Must provide a navigator name" unless _navigator.is_a? String

  begin
    puts "Navigating, waiting to hit a reducer...".color(Console::Colors::NOTICE)
    service.with_navigator_decorator Shared::SnapshotDecorator do
      if _query.nil?
        service.with_navigator_decorator Shared::InteractiveDecorator do
          service.transition _context, _navigator
        end
      else
        _query = parse_query_string _query
        service.transition _context, _navigator, _query
      end
    end
    puts "Navigation completed".color(Console::Colors::NOTICE)
  rescue Exception => e
    puts "#{e.to_s}".color Console::Colors::ERROR
    puts e.backtrace
  end
end