Class: FileNode

Inherits:
CollectionNode show all
Defined in:
lib/model/file_node.rb

Instance Attribute Summary collapse

Attributes inherited from CollectionNode

#nodes

Attributes inherited from BaseNode

#level, #location, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CollectionNode

#complexity, #functions, #pot_smell, #size, #tangle_share

Methods inherited from BaseNode

#complexity_share, #complexity_smells, #folder?, #function?, #path, #private?, #quality, #smells, #tangle_share, #tangle_smells

Constructor Details

#initialize(name, location, visibility, level) ⇒ FileNode

Returns a new instance of FileNode.



7
8
9
10
11
# File 'lib/model/file_node.rb', line 7

def initialize(name, location, visibility, level)
	super name, location, visibility, level
	@dependencies = {}
	@external_dependencies = {}
end

Instance Attribute Details

#dependenciesObject

Returns the value of attribute dependencies.



5
6
7
# File 'lib/model/file_node.rb', line 5

def dependencies
  @dependencies
end

#external_dependenciesObject

Returns the value of attribute external_dependencies.



5
6
7
# File 'lib/model/file_node.rb', line 5

def external_dependencies
  @external_dependencies
end

Class Method Details

.create_private(name, location, level) ⇒ Object



45
46
47
# File 'lib/model/file_node.rb', line 45

def self.create_private(name, location, level)
	self.new name, location, :private, level
end

.create_public(name, location, level) ⇒ Object



41
42
43
# File 'lib/model/file_node.rb', line 41

def self.create_public(name, location, level)
	self.new name, location, :public, level
end

Instance Method Details

#add_dependency(from, to) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/model/file_node.rb', line 29

def add_dependency(from, to)
	deps = (@nodes.has_key? to) ? @dependencies : @external_dependencies
	deps[to] ||= {}

	deps[to][from] ||= {:dep => 0, :circ => false}
	deps[to][from][:dep] += 1
	if deps[from] and deps[from][to]
		deps[to][from][:circ] = deps[to][from][:dep] >= deps[from][to][:dep]
		deps[from][to][:circ] = deps[from][to][:dep] >= deps[to][from][:dep]
	end
end

#add_private_function(name) ⇒ Object



17
18
19
20
21
# File 'lib/model/file_node.rb', line 17

def add_private_function(name)
	ret = add_private_node name, FunctionNode
	check_node name
	ret
end

#add_public_function(name) ⇒ Object



23
24
25
26
27
# File 'lib/model/file_node.rb', line 23

def add_public_function(name)
	ret = add_public_node name, FunctionNode
	check_node name
	ret
end

#file?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/model/file_node.rb', line 13

def file?
	true
end