Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created August 31, 2011 20:39
Show Gist options
  • Save ashaw/1184653 to your computer and use it in GitHub Desktop.
Save ashaw/1184653 to your computer and use it in GitHub Desktop.
def ap_less_than_10(number)
lookup = {
1 => "one",
2 => "two",
3 => "three",
4 => "four",
5 => "five",
6 => "six",
7 => "seven",
8 => "eight",
9 => "nine",
10 => "ten"
}
number = number <= 10 ? lookup[number] : number
end
@kleinmatic
Copy link

def to_ap(num)
  if num < 11
    wordy_num = Array['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
    return wordy_num[num]
  end
  num
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment