Class: Links

Inherits:
Object
  • Object
show all
Defined in:
lib/soks-view.rb

Overview

This class records all the links between pages

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLinks

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

Returns the value of attribute links.



51
52
53
# File 'lib/soks-view.rb', line 51

def links
  @links
end

Instance Method Details



57
# File 'lib/soks-view.rb', line 57

def links_from( page ) ; return @links[ page ] ; end


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