Code Coverage
 
Lines
Covered
96.15% covered (success)
96.15%
25 / 26
1
module TheFox
1
module TermKit
1
class Controller
1
attr_reader :subcontrollers
1
def initialize
#puts 'Controller initialize'
26
@is_active = false
26
@subcontrollers = []
end
1
def active
10
@is_active = true
10
@subcontrollers.each do |subcontroller|
6
subcontroller.active
end
end
1
def inactive
5
@is_active = false
5
@subcontrollers.each do |subcontroller|
3
subcontroller.inactive
end
end
1
def is_active?
21
@is_active
end
1
def handle_event(event)
#puts "Controller handle_event: #{event.class}"
end
1
def add_subcontroller(subcontroller)
13
if !subcontroller.is_a?(Controller)
1
raise ArgumentError, "Argument is not a Controller -- #{subcontroller.class} given"
end
12
if !@subcontrollers.is_a?(Array)
0
raise Exception::ParentClassNotInitializedException, "@subcontrollers is not an Array -- #{@subcontrollers.class} given"
end
12
@subcontrollers.push(subcontroller)
end
1
def remove_subcontroller(subcontroller)
3
@subcontrollers.delete(subcontroller)
end
end
end
end