Class: Rlyeh::DeepOnes::Parser

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/rlyeh/deep_ones/parser.rb

Instance Method Summary collapse

Methods included from Logger

crash, format_exception

Constructor Details

#initialize(app) ⇒ Parser

Returns a new instance of Parser.



9
10
11
# File 'lib/rlyeh/deep_ones/parser.rb', line 9

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/rlyeh/deep_ones/parser.rb', line 13

def call(env)
  begin
    message = Ircp.parse env.data
    env.message = message
    env.event = message.command.to_s.downcase
    @app.call env if @app
  rescue Ircp::ParseError => e
    debug "#{e.class}: #{e.to_s}"
  end
end