Class: JasmineParser::Node
- Inherits:
-
Object
- Object
- JasmineParser::Node
show all
- Defined in:
- lib/jasmine-parser/nodes/node.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args) ⇒ Node
Returns a new instance of Node.
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/jasmine-parser/nodes/node.rb', line 38
def initialize(args)
@name = args[:name]
@line = args[:line]
@parent = args[:parent]
@children = args[:children] || []
@filename = args[:filename]
@js_object = args[:js_object]
end
|
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
37
38
39
|
# File 'lib/jasmine-parser/nodes/node.rb', line 37
def children
@children
end
|
#filename ⇒ Object
Returns the value of attribute filename.
36
37
38
|
# File 'lib/jasmine-parser/nodes/node.rb', line 36
def filename
@filename
end
|
#js_object ⇒ Object
Returns the value of attribute js_object.
36
37
38
|
# File 'lib/jasmine-parser/nodes/node.rb', line 36
def js_object
@js_object
end
|
#line ⇒ Object
Returns the value of attribute line.
36
37
38
|
# File 'lib/jasmine-parser/nodes/node.rb', line 36
def line
@line
end
|
#name ⇒ Object
Returns the value of attribute name.
36
37
38
|
# File 'lib/jasmine-parser/nodes/node.rb', line 36
def name
@name
end
|
#parent ⇒ Object
Returns the value of attribute parent.
37
38
39
|
# File 'lib/jasmine-parser/nodes/node.rb', line 37
def parent
@parent
end
|
Class Method Details
.function_invocation(args) ⇒ Object
78
79
80
|
# File 'lib/jasmine-parser/nodes/node.rb', line 78
def self.function_invocation(args)
FunctionInvocation.new args
end
|
.group(args) ⇒ Object
Also known as:
context, describe
61
62
63
|
# File 'lib/jasmine-parser/nodes/node.rb', line 61
def self.group(args)
GroupNode.new args
end
|
.it(args) ⇒ Object
57
58
59
|
# File 'lib/jasmine-parser/nodes/node.rb', line 57
def self.it(args)
ExampleNode.new args
end
|
.root(args) ⇒ Object
53
54
55
|
# File 'lib/jasmine-parser/nodes/node.rb', line 53
def self.root(args)
RootNode.new args
end
|
.shared_behavior_declaration(args) ⇒ Object
70
71
72
|
# File 'lib/jasmine-parser/nodes/node.rb', line 70
def self.shared_behavior_declaration(args)
SharedBehaviorDeclaration.new args
end
|
.shared_behavior_invocation(args) ⇒ Object
74
75
76
|
# File 'lib/jasmine-parser/nodes/node.rb', line 74
def self.shared_behavior_invocation(args)
SharedBehaviorInvocation.new args
end
|
Instance Method Details
#clone ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/jasmine-parser/nodes/node.rb', line 82
def clone
args = {
:name => name,
:line => line,
:parent => parent,
:children => [],
:filename => filename,
:js_object => js_object
}
new_clone = Node.send(self.type, args)
self.children.each do |child|
new_clone.children << child.clone
end
update_the_parent_for_all_children(new_clone)
new_clone
end
|
103
104
105
|
# File 'lib/jasmine-parser/nodes/node.rb', line 103
def formatted_name
name + " "
end
|
#ready_to_be_adopted? ⇒ Boolean
107
108
109
|
# File 'lib/jasmine-parser/nodes/node.rb', line 107
def ready_to_be_adopted?
true
end
|