Sha256: 3c1156eaa1c04e37b61b90712d6a6ed5728a7104a21ffacf8814a88243f9d543

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

module EmailInquire
  class Response

    attr_reader :email
    attr_accessor :replacement, :status

    def initialize(email:)
      @email = email
    end

    def hint!(domain:)
      self.status = :hint

      old_name, _old_domain = email.split("@")
      self.replacement = "#{old_name}@#{domain}"

      self
    end

    def hint?
      status.equal?(:hint)
    end

    def invalid!
      self.status = :invalid

      self
    end

    def invalid?
      status.equal?(:invalid)
    end

    def status?
      !status.nil?
    end

    def valid!
      self.status = :valid

      self
    end

    def valid?
      status.equal?(:valid)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
email_inquire-0.11.0 lib/email_inquire/response.rb
email_inquire-0.10.0 lib/email_inquire/response.rb