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.



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

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.



84
85
86
# File 'lib/imposition/clases.rb', line 84

def id
  @id
end

#levelObject (readonly)

Returns the value of attribute level.



84
85
86
# File 'lib/imposition/clases.rb', line 84

def level
  @level
end

#mensajeObject (readonly)

Returns the value of attribute mensaje.



84
85
86
# File 'lib/imposition/clases.rb', line 84

def mensaje
  @mensaje
end

Instance Method Details

#==(msg) ⇒ Object



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

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

#to_sObject



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

def to_s
	if @level==1 then
		@retorno=I18n.t(:info)+": "
	elsif @level==2 then
		@retorno=I18n.t(:warn)+": "
	elsif @level==3 then
		@retorno=I18n(:error)+": "
	end
	@retorno+=@mensaje.to_s
	return @retorno
end