class RRSE::Command::PipeQuery
Public Class Methods
new(dir)
click to toggle source
# File lib/rrse/pipe-query-command.rb, line 10 def initialize(dir) @dir = dir @db = nil end
short_description()
click to toggle source
# File lib/rrse/pipe-query-command.rb, line 6 def self.short_description "invoke query process" end
Public Instance Methods
options()
click to toggle source
# File lib/rrse/pipe-query-command.rb, line 15 def options opts = OptionParser.new opts.banner = "Usage: rrse [global-options] pipe-query" opts.on("-s SEP", "separator"){|sep| @separator = sep } opts end
run(argv)
click to toggle source
# File lib/rrse/pipe-query-command.rb, line 22 def run(argv) options.parse!(argv) @db = RRSE::Database.new(@dir, @separator) while line = gets query_type, query_str = line.strip.split(/\s+/) case query_type when "full-name" puts @db.query_full_name(query_str) when "instance-method" puts @db.query_instance_method(query_str) when "toplevel-method" puts @db.query_toplevel_method(query_str) when "quit" return else STDERR.puts "unknown query type: #{query_type}" end end end