Skip to content

Instantly share code, notes, and snippets.

@universal
Forked from adammcarth/find.rb
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save universal/2cd1c2077b52c8d28ebe to your computer and use it in GitHub Desktop.
Save universal/2cd1c2077b52c8d28ebe to your computer and use it in GitHub Desktop.
class JTask
# JTask.find()
# Retrieves records from the database file.
# --------------------------------------------------------------------------------
# Eg: JTask.find("test.json", 1) || JTask.find("test.json", first: 10)
# #=> <JTask id=x, ...>
# --------------------------------------------------------------------------------
# See wiki guide for more usage examples...
# https://github.com/adammcarthur/jtask/wiki/find
def self.find(file, id_or_options)
do_something_with_the_file
case id_or_options
when Integer
self.find_by_id(file, id_or_options)
when Array
self.find_many(file, id_or_options)
when Hash
when :all
self.find_all...
end
def self.find_by_id(..)
...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment