Sha256: c722e79315c8013f56395d1ee293fe990e11f55b97f0362fc89d6e8d1fb33ce6

Contents?: true

Size: 422 Bytes

Versions: 3

Compression:

Stored size: 422 Bytes

Contents

module Lita
  module Handlers
    class Doubler < Handler
      # insert handler code here
      #
      route /^double\s+(\d+)$/i,
        :double,
        command: true,
        help: { 'double N' => 'prints N + N' }


      def double(response)
        n = response.matches.first.first
        n = Integer(n)

        response.reply "#{n} + #{n} = #{n+n}"
      end

      Lita.register_handler(self)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lita-doubler-0.1.2 lib/lita/handlers/doubler.rb
lita-doubler-0.1.1 lib/lita/handlers/doubler.rb
lita-doubler-0.1.0 lib/lita/handlers/doubler.rb