class EmailAddress

Contains all parameters that defines an email address

Attributes

email[R]
name[R]

Public Class Methods

new(name = nil, email = name) click to toggle source
# File lib/email_api/email/data/email_address.rb, line 6
def initialize(name = nil, email = name)
  @name  = name
  @email = email
end

Public Instance Methods

to_hash() click to toggle source
# File lib/email_api/email/data/email_address.rb, line 11
def to_hash
  hash = {}
  instance_variables.each do |var|
    name       = var.to_s.delete('@')
    value      = instance_variable_get(var)
    val_hash   = value.to_hash if value.respond_to?(:to_hash)
    hash[name] = val_hash.nil? ? value : val_hash
  end
  hash
end