Method: WeightedSelect::Selector#select

Defined in:
lib/weighted-select.rb

#selectObject|nil

Select weighted-random item if where are any in weights hash

Returns:

  • (Object|nil)


35
36
37
# File 'lib/weighted-select.rb', line 35

def select
  extract_item unless @weights.empty?
end