Class: Webspinne::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/webspinne/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, onsite = false) ⇒ Link

Returns a new instance of Link.



5
6
7
8
9
# File 'lib/webspinne/link.rb', line 5

def initialize uri, onsite=false
  @uri = uri
  @onsite = onsite
  @visited = false
end

Instance Attribute Details

#onsiteObject (readonly)

Returns the value of attribute onsite.



3
4
5
# File 'lib/webspinne/link.rb', line 3

def onsite
  @onsite
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/webspinne/link.rb', line 3

def uri
  @uri
end

Instance Method Details

#offsite?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/webspinne/link.rb', line 27

def offsite?
  !onsite?
end

#onsite?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/webspinne/link.rb', line 23

def onsite?
  onsite == true
end

#visited!Object



11
12
13
14
15
16
17
# File 'lib/webspinne/link.rb', line 11

def visited!
  if visited?
    raise DoubleVisitError, uri
  else
    @visited = true
  end
end

#visited?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/webspinne/link.rb', line 19

def visited?
  @visited == true
end