Class: BehaveFun::Tree
- Inherits:
-
Task
- Object
- Task
- BehaveFun::Tree
show all
- Defined in:
- lib/behave_fun/tree.rb
Instance Attribute Summary collapse
Attributes inherited from Task
#children, #context, #control, #guard, #params, #status
Instance Method Summary
collapse
Methods inherited from Task
#cancel, #cancelled?, #ended?, #fail, #failed?, #fresh?, #guard_passed?, #initialize, #run, #running, #running?, #start, #succeeded?, #success, task_name
#name, #serializable_status_fields
Instance Attribute Details
#root ⇒ Object
Returns the value of attribute root.
3
4
5
|
# File 'lib/behave_fun/tree.rb', line 3
def root
@root
end
|
Instance Method Details
#add_child(child) ⇒ Object
tree does not have children, it only contains a root
36
37
38
|
# File 'lib/behave_fun/tree.rb', line 36
def add_child(child)
self.root = child
end
|
#as_json ⇒ Object
45
46
47
48
49
50
|
# File 'lib/behave_fun/tree.rb', line 45
def as_json
{
version: 1,
root: root.as_json
}
end
|
#child_fail ⇒ Object
31
32
33
|
# File 'lib/behave_fun/tree.rb', line 31
def child_fail
fail
end
|
#child_running ⇒ Object
23
24
25
|
# File 'lib/behave_fun/tree.rb', line 23
def child_running
running
end
|
#child_success ⇒ Object
27
28
29
|
# File 'lib/behave_fun/tree.rb', line 27
def child_success
success
end
|
#context=(context) ⇒ Object
14
15
16
17
|
# File 'lib/behave_fun/tree.rb', line 14
def context=(context)
@context = context
@root.context = context
end
|
#dump_status ⇒ Object
52
53
54
|
# File 'lib/behave_fun/tree.rb', line 52
def dump_status
root.dump_status
end
|
#dup ⇒ Object
60
61
62
63
64
|
# File 'lib/behave_fun/tree.rb', line 60
def dup
cloned = self.class.new(params)
cloned.root = root.dup
cloned
end
|
#execute ⇒ Object
19
20
21
|
# File 'lib/behave_fun/tree.rb', line 19
def execute
root.run
end
|
#reset ⇒ Object
40
41
42
43
|
# File 'lib/behave_fun/tree.rb', line 40
def reset
super
root.reset
end
|
#restore_status(data) ⇒ Object
56
57
58
|
# File 'lib/behave_fun/tree.rb', line 56
def restore_status(data)
root.restore_status(data)
end
|
#tree ⇒ Object
10
11
12
|
# File 'lib/behave_fun/tree.rb', line 10
def tree
self
end
|