Class: EmailVeracity::Address

Inherits:
Object
  • Object
show all
Includes:
Validatability
Defined in:
lib/email_veracity/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validatability

#errors, #valid?

Constructor Details

#initialize(email = '') ⇒ Address

Returns a new instance of Address.



8
9
10
# File 'lib/email_veracity/address.rb', line 8

def initialize(email = '')
  self.email_address = email
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



6
7
8
# File 'lib/email_veracity/address.rb', line 6

def domain
  @domain
end

Instance Method Details

#email_addressObject



16
17
18
# File 'lib/email_veracity/address.rb', line 16

def email_address
  @email_address.to_s.strip
end

#email_address=(new_email_address) ⇒ Object



20
21
22
23
# File 'lib/email_veracity/address.rb', line 20

def email_address=(new_email_address)
  @email_address = new_email_address.to_s
  @domain = Domain.new(@email_address.split('@')[1] || '')
end

#to_sObject



12
13
14
# File 'lib/email_veracity/address.rb', line 12

def to_s
  email_address
end