class RRSE::Command::Query

Public Class Methods

new(dir) click to toggle source
# File lib/rrse/query-command.rb, line 8
def initialize(dir)
  @dir = dir
  @table = load_table(@dir.join("table"))
  @index_table = load_table(@dir.join("index_table"))
end
short_description() click to toggle source
# File lib/rrse/query-command.rb, line 4
def self.short_description
  "query method parameters from method name"
end

Public Instance Methods

load_table(path) click to toggle source
# File lib/rrse/query-command.rb, line 14
def load_table(path)
  table = Hash.new
  File.open(path) do |f|
    f.each_line do |line|
      line.chomp!
      key, *entries = line.split(/\t/)
      table[key] = entries
    end
  end
  table
end
run(argv) click to toggle source
# File lib/rrse/query-command.rb, line 26
def run(argv)
  query = argv.shift
  method_specs = @index_table[query]
  return unless method_specs
  method_specs.each do |spec|
    @table[spec].each do |param|
      puts "#{spec}#{param}"
    end
  end
end