Module: BinSearch

Defined in:
lib/bin_search.rb,
lib/bin_search/version.rb,
lib/bin_search/bin_search.rb

Defined Under Namespace

Modules: Methods

Constant Summary collapse

VERSION =
'0.1'
LIN_BITS =

BinSearch switches to linear search if the numer of elements to sorted is less than 1 << LIN_BITS (i.e. 2^LIN_BITS - 1)

6
MODES =
[ :asc, :desc, :asc_geq, :desc_leq, :asc_eq, :desc_eq ]
MODE_IS_ASC =
[ :asc, :asc_eq, :asc_geq ]
MODE_IS_DESC =
[ :desc, :desc_eq, :desc_leq ]
MODE_CHECK_EQ =
[ :asc_eq, :desc_eq ]

Class Method Summary collapse

Class Method Details

.filesObject



7
8
9
10
11
# File 'lib/bin_search.rb', line 7

def self.files
  f = []
  f << 'bin_search/bin_search'
  f
end

.load_relative(f) ⇒ Object



13
14
15
16
# File 'lib/bin_search.rb', line 13

def self.load_relative(f)
  path = "#{File.join(File.dirname(caller[0]), f)}.rb"
  load path
end

.reload!Object



18
19
20
# File 'lib/bin_search.rb', line 18

def self.reload!
  files.each { |f| load_relative f }
end