Method: InterMine::PathQuery::Query#first
- Defined in:
- lib/intermine/query.rb
#first(start = 0) ⇒ Object
Get the first result record from the query, starting at the given offset. If the offset is large, then this is not an efficient way to retrieve this data, and you may with to consider a looping approach or row based access instead.
560 561 562 563 564 565 566 567 568 569 570 |
# File 'lib/intermine/query.rb', line 560 def first(start=0) current_row = 0 # Have to iterate as start refers to row count results_reader.each_result { |r| if current_row == start return r end current_row += 1 } return nil end |