Class: RRSE::Command::StandaloneQuery
- Inherits:
-
Object
- Object
- RRSE::Command::StandaloneQuery
- Defined in:
- lib/rrse/standalone-query-command.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dir) ⇒ StandaloneQuery
constructor
A new instance of StandaloneQuery.
- #options ⇒ Object
- #run(argv) ⇒ Object
Constructor Details
#initialize(dir) ⇒ StandaloneQuery
Returns a new instance of StandaloneQuery.
11 12 13 14 |
# File 'lib/rrse/standalone-query-command.rb', line 11 def initialize(dir) @dir = dir @separator = " " end |
Class Method Details
.short_description ⇒ Object
7 8 9 |
# File 'lib/rrse/standalone-query-command.rb', line 7 def self.short_description "query method parameters" end |
Instance Method Details
#options ⇒ Object
16 17 18 19 20 |
# File 'lib/rrse/standalone-query-command.rb', line 16 def opts = OptionParser.new opts. = "Usage: rrse [global-options] standalone-query [options] query-string" opts.on("-s SEP", "separator"){|sep| @separator = sep } end |
#run(argv) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rrse/standalone-query-command.rb', line 22 def run(argv) .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 |