class SearchYJ::CLI

Public Instance Methods

detect(term) click to toggle source
# File lib/searchyj/cli.rb, line 30
def detect(term)
  opt    = symbolized_options
  key    = opt.delete(:key)
  regexp = Regexp.new(opt.delete(:regexp))

  puts JSON.dump(
      SearchYJ.detect(term, regexp, key, opt)
  )
end
list(term) click to toggle source
# File lib/searchyj/cli.rb, line 47
def list(term)
  opt  = symbolized_options
  size = opt.delete(:size)

  puts JSON.dump(
      SearchYJ.list(term, size, opt)
  )
end
rank(term) click to toggle source
# File lib/searchyj/cli.rb, line 64
def rank(term)
  opt  = symbolized_options
  rank = opt.delete(:rank)

  puts JSON.dump(
      SearchYJ.rank(term, rank, opt)
  )
end

Private Instance Methods

symbolized_options() click to toggle source
# File lib/searchyj/cli.rb, line 75
def symbolized_options
  options.map do |key, value|
    [key.to_sym, value]
  end.to_h
end