class Profession::Profession

Public Class Methods

contains_exact?(option) click to toggle source
# File lib/profession.rb, line 19
def contains_exact?(option)
  PROFESSIONS_DOWNCASED.include? clean_downcase_profession(option)
end
exact_match(option) click to toggle source
# File lib/profession.rb, line 23
def exact_match(option)
  PROFESSIONS_DOWNCASED.
    select { |x| x == clean_downcase_profession(option) }.
    map do |str|
    str.split(' ').
      map(&:capitalize).join(' ')
  end
end
list() click to toggle source
# File lib/profession.rb, line 15
def list
  PROFESSIONS
end
match(option) click to toggle source
# File lib/profession.rb, line 32
def match(option)
  PROFESSIONS_DOWNCASED.
    select { |x| x.include? clean_downcase_profession(option) }.
    map do |str|
    str.split(' ').
      map(&:capitalize).join(' ')
  end
end
size() click to toggle source
# File lib/profession.rb, line 11
def size
  PROFESSIONS.map { |v| v }.flatten.size
end

Private Class Methods

clean_downcase_profession(option) click to toggle source
# File lib/profession.rb, line 43
def clean_downcase_profession(option)
  option.to_s.strip.split(' ').map(&:strip).join(' ').downcase
end