lib/simply_useful/bsearch.rb in simply_useful-0.2.1 vs lib/simply_useful/bsearch.rb in simply_useful-0.2.2

- old
+ new

@@ -1,6 +1,10 @@ # +# DEPRECATED. Ruby now has a binary search built in +# + +# # Ruby/Bsearch - a binary search library for Ruby. # # Copyright (C) 2001 Satoru Takabayashi <satoru@namazu.org> # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. @@ -73,12 +77,10 @@ else return boundary end end - alias bsearch bsearch_first - # # Return the upper boundary. (outside) # def bsearch_upper_boundary (range = 0 ... self.length, &block) lower = range.first() -1 @@ -122,10 +124,10 @@ upper = bsearch_upper_boundary(range, &block) return lower ... upper end def bfind(range = 0 ... self.length, &block) - pos = self.bsearch(range, &block) + pos = self.bsearch_first(range, &block) return nil if pos.nil? self[pos] end end end \ No newline at end of file