class Tempo::Views::ViewRecords::Query
Query
records are handled by the console formatter, returning results from a call to Readline
Attributes
match[RW]
query[RW]
response[RW]
type[RW]
Public Class Methods
new(query, options={})
click to toggle source
# File lib/tempo/views/view_records/base.rb, line 54 def initialize(query, options={}) @query = query @type = "query" @match = options.fetch(:match, /(y|Y)(es)?/) @response = Reporter.add_view_record self end
Public Instance Methods
format(&block)
click to toggle source
# File lib/tempo/views/view_records/base.rb, line 65 def format(&block) # TODO: should we create an interactive default? using: # confirm = Readline.readline('> ', true).match(/(y|Y)(es)?/) block ||= lambda { |q| puts "#{q.query}"; Readline.readline('> ', true) } response = block.call self end
positive_response?()
click to toggle source
# File lib/tempo/views/view_records/base.rb, line 61 def positive_response? true if @response.match(@match) end