module EightBall::Conditions

Public Class Methods

by_name(name) click to toggle source

Finds the Condition class based on its name @param [String] name The case insensitive name to find the Condition for @return [EightBall::Conditions] the Condition class represented by the given name

# File lib/eight_ball/conditions/conditions.rb, line 7
def self.by_name(name)
  mappings = {
    always: EightBall::Conditions::Always,
    list: EightBall::Conditions::List,
    never: EightBall::Conditions::Never,
    range: EightBall::Conditions::Range
  }
  mappings[name.downcase.to_sym]
end