Module: TrailGuide::Algorithms

Defined in:
lib/trail_guide/algorithms.rb,
lib/trail_guide/algorithms/bandit.rb,
lib/trail_guide/algorithms/random.rb,
lib/trail_guide/algorithms/weighted.rb,
lib/trail_guide/algorithms/distributed.rb

Defined Under Namespace

Classes: Bandit, Distributed, Random, Weighted

Class Method Summary collapse

Class Method Details

.algorithm(algo) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/trail_guide/algorithms.rb', line 8

def self.algorithm(algo)
  case algo
  when :weighted
    algo = TrailGuide::Algorithms::Weighted
  when :bandit
    algo = TrailGuide::Algorithms::Bandit
  when :distributed
    algo = TrailGuide::Algorithms::Distributed
  when :random
    algo = TrailGuide::Algorithms::Random
  else
    algo = algo.constantize if algo.is_a?(String)
  end
  algo
end