Class: FlowMonitor::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/libcfruby/flowmonitor.rb

Overview

Encapsulates a controller message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, message) ⇒ Message

Build a message. type‘s used by the library are ’exception’, ‘intention’



194
195
196
197
198
199
# File 'lib/libcfruby/flowmonitor.rb', line 194

def initialize(type, message)
	@type = type.to_s()
	@message = message.to_s()
	@tags = Hash.new()
	@caller = Kernel.caller()
end

Instance Attribute Details

#callerObject (readonly)

Returns the value of attribute caller.



190
191
192
# File 'lib/libcfruby/flowmonitor.rb', line 190

def caller
  @caller
end

#messageObject (readonly)

Returns the value of attribute message.



190
191
192
# File 'lib/libcfruby/flowmonitor.rb', line 190

def message
  @message
end

#tagsObject (readonly)

Returns the value of attribute tags.



190
191
192
# File 'lib/libcfruby/flowmonitor.rb', line 190

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



190
191
192
# File 'lib/libcfruby/flowmonitor.rb', line 190

def type
  @type
end

Instance Method Details

#add_tag(tag, value = true) ⇒ Object

adds a tag to the message



203
204
205
# File 'lib/libcfruby/flowmonitor.rb', line 203

def add_tag(tag, value=true)
	@tags[tag.to_s()] = value
end

#to_sObject

helper function to print message as a string



209
210
211
# File 'lib/libcfruby/flowmonitor.rb', line 209

def to_s()
	return("#{type} - #{message}")
end