Class: Webspinne::Link
- Inherits:
-
Object
- Object
- Webspinne::Link
- Defined in:
- lib/webspinne/link.rb
Instance Attribute Summary collapse
-
#onsite ⇒ Object
readonly
Returns the value of attribute onsite.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(uri, onsite = false) ⇒ Link
constructor
A new instance of Link.
- #offsite? ⇒ Boolean
- #onsite? ⇒ Boolean
- #visited! ⇒ Object
- #visited? ⇒ Boolean
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
#onsite ⇒ Object (readonly)
Returns the value of attribute onsite.
3 4 5 |
# File 'lib/webspinne/link.rb', line 3 def onsite @onsite end |
#uri ⇒ Object (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
27 28 29 |
# File 'lib/webspinne/link.rb', line 27 def offsite? !onsite? end |
#onsite? ⇒ 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
19 20 21 |
# File 'lib/webspinne/link.rb', line 19 def visited? @visited == true end |