Class: ProxyMachine
- Inherits:
-
Object
- Object
- ProxyMachine
- Defined in:
- lib/proxymachine.rb
Class Method Summary collapse
- .decr ⇒ Object
- .incr ⇒ Object
- .log(str) ⇒ Object
- .router ⇒ Object
- .run(host, port) ⇒ Object
- .set_router(block) ⇒ Object
Class Method Details
.decr ⇒ Object
18 19 20 21 22 |
# File 'lib/proxymachine.rb', line 18 def self.decr @@counter ||= 0 @@counter -= 1 log @@counter end |
.incr ⇒ Object
12 13 14 15 16 |
# File 'lib/proxymachine.rb', line 12 def self.incr @@counter ||= 0 @@counter += 1 log @@counter end |
.log(str) ⇒ Object
8 9 10 |
# File 'lib/proxymachine.rb', line 8 def self.log(str) puts str if false end |
.router ⇒ Object
28 29 30 |
# File 'lib/proxymachine.rb', line 28 def self.router @@router end |
.run(host, port) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/proxymachine.rb', line 32 def self.run(host, port) EM.epoll EM.run do EventMachine::Protocols::ClientConnection.start(host, port) end end |
.set_router(block) ⇒ Object
24 25 26 |
# File 'lib/proxymachine.rb', line 24 def self.set_router(block) @@router = block end |