module Mat

Constants

VERSION

Public Class Methods

all(query = nil) click to toggle source
# File lib/mat.rb, line 17
def all(query = nil)
  Foodstuff.all(query)
end
api(config = nil) { |config| ... } click to toggle source
# File lib/mat.rb, line 11
def api(config = nil)
  (@api ||= API.new config).tap do |api|
    yield(api.config) if block_given?
  end
end
find(number, nutrient = nil) click to toggle source
# File lib/mat.rb, line 21
def find(number, nutrient = nil)
  if number.to_s.match(/^\d+$/)
    Foodstuff.find(number, nutrient)
  else
    Foodstuff.all(number).first
  end
end
nutrient(slug) click to toggle source
# File lib/mat.rb, line 29
def nutrient(slug)
  Nutrient.find(slug)
end
nutrients() click to toggle source
# File lib/mat.rb, line 33
def nutrients
  Nutrient.all
end