class Ruboty::SuddenlyDeath::Actions::SuddenlyDeath

Public Instance Methods

call() click to toggle source
# File lib/ruboty/sd/actions/suddenly_death.rb, line 5
def call
  message.reply(suddenly_death)
rescue => e
  message.reply(e.message)
end

Private Instance Methods

suddenly_death() click to toggle source
# File lib/ruboty/sd/actions/suddenly_death.rb, line 12
        def suddenly_death
          word = message[1]
          display_length = word.chars.map{|c| c.bytesize == 1 ? 1 : 2}.inject(:+)
          balloon_length = (display_length / 2.0).ceil

          reply = <<-EOS
_人#{'人' * balloon_length}人_
> #{word} <
 ̄Y^#{'Y^' * (balloon_length - 1)}Y ̄
          EOS
          reply
        end