Module: MessQ::Session
- Defined in:
- lib/messQ/session.rb
Class Method Summary collapse
Class Method Details
.handler(session) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/messQ/session.rb', line 6 def self.handler(session) request = session.gets Thread.start(session, request) do |session, request| if request.match(/[eE][nN][qQ]\ /) MessQ.q << request.gsub(/[eE][nN][qQ]\ /, '').chomp MessQ::Verbose.logme "added to messQ: #{MessQ.q[-1]}" session.print MessQ.q[-1] elsif request.match(/[dD][eE][qQ]/) deq = MessQ.q.shift MessQ::Verbose.logme "removed from messQ: #{deq}" session.print deq end session.close end end |