Permalink
Browse files

Refactor and fix EdgeSet#find

  • Loading branch information...
1 parent 00cc294 commit dcc10a68a0a2718c3e70f4e2ebdb1e9dc55d433d @jamesdabbs committed Apr 11, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/steffi/edge_set.rb
@@ -34,8 +34,9 @@ def each
end
def find pair, error=false
- id = FFI::MemoryPointer.new :int
- Igraph.get_eid @graph.pointer, id, pair.first, pair.last, @graph.directed?, error
+ FFI::MemoryPointer.new(:int).tap do |id|
+ Igraph.get_eid @graph.pointer, id, pair.first, pair.last, @graph.directed?, error
+ end.get_int 0
end
def find_pairs *pairs

0 comments on commit dcc10a6

Please sign in to comment.