class RRSE::Command::StandaloneQuery

Public Class Methods

new(dir) click to toggle source
# File lib/rrse/standalone-query-command.rb, line 11
def initialize(dir)
  @dir = dir
  @separator = " "
end
short_description() click to toggle source
# File lib/rrse/standalone-query-command.rb, line 7
def self.short_description
  "query method parameters"
end

Public Instance Methods

options() click to toggle source
# File lib/rrse/standalone-query-command.rb, line 16
def options
  opts = OptionParser.new
  opts.banner = "Usage: rrse [global-options] standalone-query [options] query-string"
  opts.on("-s SEP", "separator"){|sep| @separator = sep }
end
run(argv) click to toggle source
# File lib/rrse/standalone-query-command.rb, line 22
def run(argv)
  options.parse!(argv)
  query_type = argv.shift
  query = argv.shift
  show_help_and_exit unless query

  db = RRSE::Database.new(@dir, @separator)

  case query_type
  when "full-name"
    puts db.query_full_name(query)
  when "instance-method"
    puts db.query_instance_method(query)
  when "toplevel-method"
    puts db.query_toplevel_method(query)
  else
    STDERR.puts "unknown query type: #{query_type}"
  end
end