Class: PhisherPhinder::BodyHyperlink

Inherits:
Object
  • Object
show all
Defined in:
lib/phisher_phinder/body_hyperlink.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href, text) ⇒ BodyHyperlink

Returns a new instance of BodyHyperlink.



7
8
9
10
11
12
# File 'lib/phisher_phinder/body_hyperlink.rb', line 7

def initialize(href, text)
  @type = classify_href(href.strip)
  @raw_href = href
  @href = parse_href(href)
  @text = text
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



5
6
7
# File 'lib/phisher_phinder/body_hyperlink.rb', line 5

def href
  @href
end

#raw_hrefObject (readonly)

Returns the value of attribute raw_href.



5
6
7
# File 'lib/phisher_phinder/body_hyperlink.rb', line 5

def raw_href
  @raw_href
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/phisher_phinder/body_hyperlink.rb', line 5

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/phisher_phinder/body_hyperlink.rb', line 5

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/phisher_phinder/body_hyperlink.rb', line 18

def ==(other)
  href == other.href && text == other.text
end

#supports_retrieval?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/phisher_phinder/body_hyperlink.rb', line 14

def supports_retrieval?
  @type == :url && href.is_a?(URI)
end