class HorseSay

Constants

BOTTOM_LINE_CHAR
TALK_LINE_CHAR
UPPER_LINE_CHAR
VERSION

Public Class Methods

interpolate_text(text) click to toggle source
# File lib/horse_say.rb, line 16
    def interpolate_text(text)
      "
                                          #{UPPER_LINE_CHAR * text.length}
                                        < #{text} >
                                          #{BOTTOM_LINE_CHAR * text.length}
                                      #{TALK_LINE_CHAR}
                                     #{TALK_LINE_CHAR}
                                    #{TALK_LINE_CHAR}
#{self}
      "
    end
say(text) click to toggle source
# File lib/horse_say.rb, line 11
def say(text)
  text = interpolate_text(text.gsub(/[\n\t]/, ''))
  puts(text)
end
to_s() click to toggle source
# File lib/horse_say.rb, line 28
def to_s
  @to_s ||= File.read("#{__dir__}/horse.txt")
end