Class: Irc::Bot::MessageMapper::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/rbot/messagemapper.rb

Constant Summary collapse

STRING =
"template %{template} failed to recognize message %{message}"
FRIENDLY =
"I failed to understand the command"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tmpl, msg) ⇒ Failure

Returns a new instance of Failure.



61
62
63
64
# File 'lib/rbot/messagemapper.rb', line 61

def initialize(tmpl, msg)
  @template = tmpl
  @message = msg
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



60
61
62
# File 'lib/rbot/messagemapper.rb', line 60

def message
  @message
end

#templateObject (readonly)

Returns the value of attribute template.



59
60
61
# File 'lib/rbot/messagemapper.rb', line 59

def template
  @template
end

Instance Method Details

#to_sObject



66
67
68
69
70
71
72
73
# File 'lib/rbot/messagemapper.rb', line 66

def to_s
  STRING % {
    :template => template.template,
    :regexp => template.regexp,
    :message => message.message,
    :action => template.options[:action]
  }
end