Class: PrimeNumbers::Algorithm

Inherits:
Object
  • Object
show all
Defined in:
lib/prime-numbers/algorithms/algorithm.rb

Constant Summary collapse

ALGORITHMS =
{
  one_liner: AlgorithmOneLiner,
  sieve_of_eratosthenes: AlgorithmSieveOfEratosthenes
}

Class Method Summary collapse

Class Method Details

.with_strategy(strategy) ⇒ Object



11
12
13
# File 'lib/prime-numbers/algorithms/algorithm.rb', line 11

def self.with_strategy strategy
  ALGORITHMS[strategy].new
end