Class: RubyJard::Screens
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/ruby_jard/screens.rb,
lib/ruby_jard/screens/menu_screen.rb,
lib/ruby_jard/screens/source_screen.rb,
lib/ruby_jard/screens/threads_screen.rb,
lib/ruby_jard/screens/backtrace_screen.rb,
lib/ruby_jard/screens/variables_screen.rb
Overview
Screen registry. The screens call add_screen right after they are declared.
Defined Under Namespace
Classes: BacktraceScreen, MenuScreen, SourceScreen, ThreadsScreen, VariablesScreen
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Screens.
18
19
20
|
# File 'lib/ruby_jard/screens.rb', line 18
def initialize
@screen_registry = {}
end
|
Class Method Details
.instance ⇒ Object
13
14
15
|
# File 'lib/ruby_jard/screens.rb', line 13
def instance
@instance ||= new
end
|
Instance Method Details
#[](name) ⇒ Object
Also known as:
get
30
31
32
|
# File 'lib/ruby_jard/screens.rb', line 30
def [](name)
@screen_registry[name.to_s]
end
|
#add_screen(name, screen_class) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/ruby_jard/screens.rb', line 22
def add_screen(name, screen_class)
unless screen_class < RubyJard::Screen
raise RubyJard::Error, "#{screen_class} must implement, and inherit from #{RubyJard::Screen}"
end
@screen_registry[name.to_s] = screen_class
end
|
#names ⇒ Object
35
36
37
|
# File 'lib/ruby_jard/screens.rb', line 35
def names
@screen_registry.keys.sort.dup
end
|