Module: BeltsEngine::ToolsManager
- Included in:
- Game
- Defined in:
- lib/belts_engine/tools_manager.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &blk) ⇒ Object
19
20
21
22
23
|
# File 'lib/belts_engine/tools_manager.rb', line 19
def method_missing(name, *args, &blk)
raise "Tool #{name} not registered" unless tools.key?(name)
tools[name]
end
|
Instance Method Details
7
8
9
10
11
|
# File 'lib/belts_engine/tools_manager.rb', line 7
def register_tool(name, obj)
raise "Tool #{name} already in use" if tools.key?(name)
tools[name] = obj
end
|
#respond_to?(name, include_private = false) ⇒ Boolean
13
14
15
|
# File 'lib/belts_engine/tools_manager.rb', line 13
def respond_to?(name, include_private = false)
super || tools.key?(name.to_sym)
end
|
3
4
5
|
# File 'lib/belts_engine/tools_manager.rb', line 3
def tools
@_tools ||= {}
end
|