Skip to content

Instantly share code, notes, and snippets.

@danielpuglisi
Created October 23, 2012 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpuglisi/3939890 to your computer and use it in GitHub Desktop.
Save danielpuglisi/3939890 to your computer and use it in GitHub Desktop.
# Convert a locations response to an Array of Location Objects
#
# response - The Hash object from an API response
#
# Returns an array of Location objects, returns nil if the Hash is empty
def self.objectify(response)
response.empty? ? nil : response.map {|station| Rtransport::Location.new(station)}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment