Class: Gloo::Core::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/core/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeError

Set up the error object.



16
17
18
# File 'lib/gloo/core/error.rb', line 16

def initialize
  clear
end

Instance Attribute Details

#error_countObject

Returns the value of attribute error_count.



11
12
13
# File 'lib/gloo/core/error.rb', line 11

def error_count
  @error_count
end

#valueObject

Returns the value of attribute value.



11
12
13
# File 'lib/gloo/core/error.rb', line 11

def value
  @value
end

Instance Method Details

#clearObject

Clear out the error message.



23
24
25
26
# File 'lib/gloo/core/error.rb', line 23

def clear
  @error_count = 0
  @value = nil
end

#clear_if_no_errorsObject

Clear out error if we didn’t add any new ones.



48
49
50
# File 'lib/gloo/core/error.rb', line 48

def clear_if_no_errors
  self.clear if @error_count.zero?
end

#is_function?Boolean

Is this a function object?

Returns:

  • (Boolean)


62
63
64
# File 'lib/gloo/core/error.rb', line 62

def is_function?
  return false
end

#set_to(new_value) ⇒ Object

Set the value of error.



31
32
33
34
# File 'lib/gloo/core/error.rb', line 31

def set_to( new_value )
  @error_count += 1
  @value = new_value
end

#start_trackingObject

Start counting errors. We’re looking to see if we get any new ones during a script or an immediate command.



41
42
43
# File 'lib/gloo/core/error.rb', line 41

def start_tracking
  @error_count = 0
end

#to_sObject

Get the string representation of the error.



55
56
57
# File 'lib/gloo/core/error.rb', line 55

def to_s
  return @value.to_s
end