Class: SlideField::ObjectManager::Base
- Inherits:
-
Object
- Object
- SlideField::ObjectManager::Base
show all
- Defined in:
- lib/slidefield/object_manager.rb
Instance Method Summary
collapse
Constructor Details
#initialize(obj, window) ⇒ Base
Returns a new instance of Base.
10
11
12
13
|
# File 'lib/slidefield/object_manager.rb', line 10
def initialize(obj, window)
@obj = obj
@window = window
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
25
26
27
28
|
# File 'lib/slidefield/object_manager.rb', line 25
def method_missing(method, *args)
raise NameError, "No such event" if method.to_s.start_with? 'on_'
execute method, *args
end
|
Instance Method Details
#execute(event, *args) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/slidefield/object_manager.rb', line 15
def execute(event, *args)
SlideField.debug "Event: #{event} (#{@obj.type} in #{@obj.context} at #{@obj.loc})"
send "on_#{event}", *args
rescue => e
SlideField.debug "Backtrace: #{e.backtrace.join "\n"}"
raise SlideField::RuntimeError,
"#{@obj.context_string} An error occured while executing the '#{event}' event on the object '#{@obj.type}' at #{@obj.loc}:\n" +
"\t(#{e.class}) #{e.message}"
end
|
#on_activate ⇒ Object
31
|
# File 'lib/slidefield/object_manager.rb', line 31
def on_activate; end
|
#on_deactivate ⇒ Object
33
|
# File 'lib/slidefield/object_manager.rb', line 33
def on_deactivate; end
|
#on_draw(animator) ⇒ Object
32
|
# File 'lib/slidefield/object_manager.rb', line 32
def on_draw(animator); end
|
#on_load ⇒ Object
30
|
# File 'lib/slidefield/object_manager.rb', line 30
def on_load; end
|
#on_unload ⇒ Object
34
|
# File 'lib/slidefield/object_manager.rb', line 34
def on_unload; end
|