Permalink
Browse files

* detect_index_no refactoring

  • Loading branch information...
1 parent dcebf6f commit 977dbd7dffb861578d9868c0f558d1daefbb7b58 @fl00r committed May 23, 2012
Showing with 4 additions and 10 deletions.
  1. +4 −10 lib/tarantool/record.rb
@@ -77,20 +77,14 @@ def first
end
def detect_index_no(keys)
- index_no = nil
- record.indexes.each_with_index do |v, i|
+ record.indexes.each.with_index do |v, i|
keys_inst = keys.dup
v.each do |index_part|
- unless keys_inst.delete(index_part)
- break
- end
- if keys_inst.size == 0
- index_no = i
- end
+ break unless keys_inst.delete(index_part)
+ return i if keys_inst.empty?
end
- break if index_no
end
- index_no
+ nil
end
def to_records(tuples)

0 comments on commit 977dbd7

Please sign in to comment.