class BaconLatin

Public Class Methods

new(text) click to toggle source
# File lib/bacon-latin/bacon_latin.rb, line 4
def initialize(text)
  @original = text
end

Public Instance Methods

to_bacon() click to toggle source
# File lib/bacon-latin/bacon_latin.rb, line 8
def to_bacon
  @original.split(' ').map.with_index { |word, index|
    if word.length > 1
      first = word[0]
      "#{word[1..-1] + first }-#{more_meat(index)}ay"
    else
      word
    end
  }.join(" ")
end

Private Instance Methods

more_meat(index) click to toggle source
# File lib/bacon-latin/bacon_latin.rb, line 21
def more_meat(index)
  [
    "bacon",
    "veal",
    "chicken",
    "meat",
    "loaf",
    "lamb",
    "mutton",
    "pork",
    "pulledpork",
    "minced",
    "quail",
    "poultry",
    "steak",
    "boar"
  ][index]
end