Sha256: 35b9c79707b0915f42992b2f3326bb26ae9c01abb7a5941d96806c8e410c4fcc
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
module FoodInfo module Adapters class FatSecret module Data class SearchResults < Hashie::Trash property :results, :from => :food property :page, :from => :page_number property :per_page, :from => :max_results property :total_results def initialize(*args) super(*args) normalize_data end def normalize_data [:page, :per_page, :total_results].each do |n| self[n] = self[n].to_i end self[:page] += 1 # FatSecret indexes their pages from 0 self[:results] = [self[:results]] unless self[:results].is_a?(Array) self[:results] = (self[:results] || []).collect {|result| SearchResult.new(result) } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
food_info-0.0.1 | lib/food_info/adapters/fat_secret/data/search_results.rb |