Module: DragonrubyEgg::Event
- Defined in:
- lib/dragonruby_egg/event.rb
Constant Summary collapse
- HANDLERS =
{}
Class Method Summary collapse
- .add(symbol, handler) ⇒ Object
- .emit(symbol, *args) ⇒ Object
- .print(event, message = "") ⇒ Object
- .set_print_active(bool) ⇒ Object
Class Method Details
.add(symbol, handler) ⇒ Object
20 21 22 |
# File 'lib/dragonruby_egg/event.rb', line 20 def add(symbol, handler) HANDLERS[symbol] = handler end |
.emit(symbol, *args) ⇒ Object
24 25 26 |
# File 'lib/dragonruby_egg/event.rb', line 24 def emit(symbol, *args) HANDLERS[symbol].call(args) end |
.print(event, message = "") ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/dragonruby_egg/event.rb', line 12 def print(event, = "") unless @is_print_active return end puts("#{Time.now.strftime("%l:%M:%S %p").lstrip} [#{APP_NAME}] #{event} | #{}") end |
.set_print_active(bool) ⇒ Object
8 9 10 |
# File 'lib/dragonruby_egg/event.rb', line 8 def set_print_active(bool) @is_print_active = bool end |