module FileDb::Query
Public Instance Methods
all()
click to toggle source
# File lib/file_db/query.rb, line 22 def all table.all.map{ |entry| new entry } end
find(id)
click to toggle source
# File lib/file_db/query.rb, line 4 def find id found_element = table.find(id) return unless found_element new found_element end
find_by(attribute, search_value)
click to toggle source
# File lib/file_db/query.rb, line 30 def find_by attribute, search_value where("#{attribute}".to_sym => search_value).first end
first()
click to toggle source
# File lib/file_db/query.rb, line 10 def first found_element = table.first return unless found_element new found_element end
last()
click to toggle source
# File lib/file_db/query.rb, line 16 def last found_element = table.last return unless found_element new found_element end
where(conditions)
click to toggle source
# File lib/file_db/query.rb, line 26 def where conditions table.where(conditions).map{ |entry| new entry } end