Created
October 23, 2012 16:27
-
-
Save danielpuglisi/3939890 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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