class Mat::CLI
Public Class Methods
get_data(query)
click to toggle source
# File lib/mat/cli.rb, line 10 def get_data(query) if query.to_s.match(/^\d+$/) Mat.api.foodstuff(query) else Mat.api.foodstuffs(query) end end
search(query)
click to toggle source
# File lib/mat/cli.rb, line 18 def search(query) puts JSON.pretty_generate get_data(query) rescue Mat::HTTP::Exception warn "Nothing found" end