Class: Ronin::Recon::Values::EmailAddress

Inherits:
Ronin::Recon::Value show all
Defined in:
lib/ronin/recon/values/email_address.rb

Overview

Represents an email address.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Ronin::Recon::Value

#==, parse, #to_csv, #to_json

Constructor Details

#initialize(address) ⇒ EmailAddress

Initializes the email address object.

Parameters:

  • address (String)

    The email address.



44
45
46
# File 'lib/ronin/recon/values/email_address.rb', line 44

def initialize(address)
  @address = address
end

Instance Attribute Details

#addressString (readonly)

The email address.

Returns:

  • (String)


36
37
38
# File 'lib/ronin/recon/values/email_address.rb', line 36

def address
  @address
end

Class Method Details

.value_type:email_address

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This is used internally to map a recon value class to a printable type.

Returns the type or kind of recon value.

Returns:

  • (:email_address)


107
108
109
# File 'lib/ronin/recon/values/email_address.rb', line 107

def self.value_type
  :email_address
end

Instance Method Details

#as_jsonHash{Symbol => Object}

Coerces the email address value into JSON.

Returns:

  • (Hash{Symbol => Object})

    The Ruby Hash that will be converted into JSON.



92
93
94
# File 'lib/ronin/recon/values/email_address.rb', line 92

def as_json
  {type: :email_address, address: @address}
end

#eql?(other) ⇒ Boolean Also known as: ===

Compares the value to another value.

Parameters:

  • other (Value)

    The other value to compare.

Returns:



58
59
60
# File 'lib/ronin/recon/values/email_address.rb', line 58

def eql?(other)
  other.kind_of?(self.class) && @address == other.address
end

#hashInteger

The "hash" value for the email address.

Returns:

  • (Integer)

    The hash of the #address.



70
71
72
# File 'lib/ronin/recon/values/email_address.rb', line 70

def hash
  [self.class, @address].hash
end

#to_sString Also known as: to_str

Converts the email address object to a String.

Returns:

  • (String)

    The email address.



80
81
82
# File 'lib/ronin/recon/values/email_address.rb', line 80

def to_s
  @address.to_s
end