Class: DSeL::Node
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(subject = nil, options = {}) ⇒ Node
Returns a new instance of Node.
17
18
19
20
21
|
# File 'lib/dsel/node.rb', line 17
def initialize( subject = nil, options = {} )
@subject = subject
@parent = options[:parent]
@root = (@parent ? @parent._dsel_node.root : self)
end
|
Instance Attribute Details
#parent ⇒ Base?
8
9
10
|
# File 'lib/dsel/node.rb', line 8
def parent
@parent
end
|
#root ⇒ Base
12
13
14
|
# File 'lib/dsel/node.rb', line 12
def root
@root
end
|
5
6
7
|
# File 'lib/dsel/node.rb', line 5
def subject
@subject
end
|
Instance Method Details
#_dsel_node ⇒ Object
28
29
30
|
# File 'lib/dsel/node.rb', line 28
def _dsel_node
self
end
|
#calc_node_hash(subject) ⇒ Object
32
33
34
|
# File 'lib/dsel/node.rb', line 32
def calc_node_hash( subject )
"#{self.class}:#{subject.object_id}".hash
end
|
36
37
38
|
# File 'lib/dsel/node.rb', line 36
def hash
calc_node_hash( @subject )
end
|
#root? ⇒ Boolean
23
24
25
|
# File 'lib/dsel/node.rb', line 23
def root?
@root == self
end
|