Class: Flexo::Events::ReplyEvent

Inherits:
Flexo::Event show all
Defined in:
lib/flexo/events/reply.rb

Overview

A numeric reply of some kind.

Defined Under Namespace

Classes: Numeric, Struct

Instance Attribute Summary collapse

Attributes inherited from Flexo::Event

#data, #nickname

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flexo::Event

#me?

Constructor Details

#initialize(*args) ⇒ ReplyEvent

Returns a new instance of ReplyEvent.



15
16
17
18
19
20
21
22
# File 'lib/flexo/events/reply.rb', line 15

def initialize(*args)
  super
  @mynickname = @data.params[0]
  @numeric    = @data.message.to_i
  @text       = @data.string
  @is_error   = @numeric >= 400
  @reply      = Struct.new
end

Instance Attribute Details

#mynicknameObject (readonly) Also known as: mynick

Returns the value of attribute mynickname.



7
8
9
# File 'lib/flexo/events/reply.rb', line 7

def mynickname
  @mynickname
end

#numericObject (readonly)

Returns the value of attribute numeric.



8
9
10
# File 'lib/flexo/events/reply.rb', line 8

def numeric
  @numeric
end

#replyObject (readonly) Also known as: struct

Returns the value of attribute reply.



10
11
12
# File 'lib/flexo/events/reply.rb', line 10

def reply
  @reply
end

#textObject (readonly)

Returns the value of attribute text.



9
10
11
# File 'lib/flexo/events/reply.rb', line 9

def text
  @text
end

Class Method Details

.[](reply) ⇒ Object



24
25
26
27
# File 'lib/flexo/events/reply.rb', line 24

def self.[](reply)
  n = (reply =~ /^\d+$/ || reply.kind_of?(Integer)) ? reply.to_i : Flexo::Numerics.const_get(reply)
  Flexo::Events::ReplyEvent::Numeric.new(n)
end