Sha256: 90b73b7647185b5b47e3bf227229510e8160af3663ef1b8bdef0e2aa145a2903

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

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

      Lita.register_handler(self)

      def double_number(n)
        n + n
      end

      def respond_with_double(response)
        n = response.match_data.captures.first
        n = Integer(n)

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-doubler-lcpp-0.1.0 lib/lita/handlers/doubler.rb