Class: Burn::Server::Telnet
- Inherits:
-
Object
- Object
- Burn::Server::Telnet
- Includes:
- Debug
- Defined in:
- lib/burn/server/telnet.rb
Defined Under Namespace
Classes: Messenger
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(fuel, conf) ⇒ Telnet
constructor
A new instance of Telnet.
- #start ⇒ Object
Methods included from Debug
Constructor Details
#initialize(fuel, conf) ⇒ Telnet
Returns a new instance of Telnet.
7 8 9 10 11 12 13 |
# File 'lib/burn/server/telnet.rb', line 7 def initialize(fuel, conf) @@op = nil @@screen_buffer = nil @@conf = conf @fuel = fuel verbose conf.app.verbose end |
Class Method Details
.conf ⇒ Object
27 28 29 |
# File 'lib/burn/server/telnet.rb', line 27 def self.conf @@conf end |
.op(receive = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/burn/server/telnet.rb', line 19 def self.op(receive=nil) if receive.nil? then @@op else @@op = receive end end |
.vm ⇒ Object
15 16 17 |
# File 'lib/burn/server/telnet.rb', line 15 def self.vm @@vm end |
Instance Method Details
#start ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/burn/server/telnet.rb', line 70 def start @@vm = Generator::TelnetVm.new(@fuel, @@conf) EM::run do EM::start_server(@@conf.server.ip_addr, @@conf.server.port, Messenger) # view EM::add_periodic_timer(frame_rate) do if @@vm.screen.to_terminal != @@screen_buffer then log "both screen and @screen_buffer is updated!" Messenger.publish @@vm.screen.to_terminal @@screen_buffer = @@vm.screen.to_terminal end end # controller + model EM::add_periodic_timer(frame_rate) do if !@@op.nil? then callback = proc do |s| @@op=nil log "callback is called." end EM::defer(@@op, callback) log "EM::defer is called." end @@vm.next_frame end #EM::set_quantum 10 end end |