Class: Links
- Inherits:
-
Object
- Object
- Links
- Defined in:
- lib/soks-view.rb
Overview
This class records all the links between pages
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
-
#initialize ⇒ Links
constructor
A new instance of Links.
- #links_from(page) ⇒ Object
- #set_links_from(page, linkarray) ⇒ Object
Constructor Details
#initialize ⇒ Links
Returns a new instance of Links.
53 54 55 |
# File 'lib/soks-view.rb', line 53 def initialize @links = Hash.new end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
51 52 53 |
# File 'lib/soks-view.rb', line 51 def links @links end |
Instance Method Details
#links_from(page) ⇒ Object
57 |
# File 'lib/soks-view.rb', line 57 def links_from( page ) ; return @links[ page ] ; end |
#set_links_from(page, linkarray) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/soks-view.rb', line 59 def set_links_from( page, linkarray ) page.links_lock.synchronize do page.links_from = @links[ page ] = linkarray.uniq set_links_to( page ) end page.links_from.each { |linked_page| linked_page.links_lock.synchronize do set_links_to( linked_page ) end } end |