summaryrefslogtreecommitdiff
path: root/lib/nickserver/request_handlers/invalid_email_handler.rb
blob: bb98f653f43c647a7ebe64455bc4e4716981ec02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'nickserver/request_handlers/base'
require 'nickserver/email_address'
require 'nickserver/error_response'

module Nickserver
  module RequestHandlers
    class InvalidEmailHandler < Base

      def handle
        return unless request.email
        ErrorResponse.new("Not a valid address") if email.invalid?
      end

      protected

      def email
        @email ||= EmailAddress.new(request.email)
      end
    end
  end
end