Class: Clases::Mensaje

Inherits:
Object
  • Object
show all
Defined in:
lib/imposition/clases.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Mensaje

Returns a new instance of Mensaje.



83
84
85
86
87
88
89
90
# File 'lib/imposition/clases.rb', line 83

def initialize(*args)
  if args.size==1 then
   @id=args[0]
  elsif args.size==2 then
    @level=args[0] #level 1=info, 2=warn, 3=error
     @mensaje=args[1]
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



82
83
84
# File 'lib/imposition/clases.rb', line 82

def id
  @id
end

#levelObject (readonly)

Returns the value of attribute level.



82
83
84
# File 'lib/imposition/clases.rb', line 82

def level
  @level
end

#mensajeObject (readonly)

Returns the value of attribute mensaje.



82
83
84
# File 'lib/imposition/clases.rb', line 82

def mensaje
  @mensaje
end

Instance Method Details

#==(msg) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/imposition/clases.rb', line 102

def ==(msg)
  if msg!=nil then
   return @id==msg.id
  else
   return false
  end
end

#to_sObject



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/imposition/clases.rb', line 91

def to_s
	if @level==1 then
		@retorno="info: "
	elsif @level==2 then
		@retorno="Warn: "
	elsif @level==3 then
		@retorno="ERROR: "
	end
	@retorno+=@mensaje.to_s
	return @retorno
end