Class: Tempo::Views::Formatters::Interactive

Inherits:
Base
  • Object
show all
Defined in:
lib/tempo/views/formatters/interactive.rb

Instance Method Summary collapse

Methods inherited from Base

#format_records, #initialize, #report

Constructor Details

This class inherits a constructor from Tempo::Views::Formatters::Base

Instance Method Details

#format_records_container(container) ⇒ Object



35
36
37
38
39
40
# File 'lib/tempo/views/formatters/interactive.rb', line 35

def format_records_container(container)
  # Pass through over-ride
  # We don't allow interactive containers at this time because they
  # would need to be able to detect when the container is complete.
  # (report containers raised errors on nil durations).
end

#message_block(record) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tempo/views/formatters/interactive.rb', line 13

def message_block(record)
  record.format do |m|
    case m.category
    when :immediate
      puts "#{m.message}"
    when :progress
      puts "#{m.message}..."
    when :progress_partial
      $stdout.sync = true
      print "#{m.message}..."
    end
    m.message
  end
end

#query_block(query) ⇒ Object



28
29
30
31
32
33
# File 'lib/tempo/views/formatters/interactive.rb', line 28

def query_block(query)
  query.format do |q|
    puts q.query
    response = Readline.readline('> ', true)
  end
end