Sha256: d958b30d86fc948a0d69ae4e1dc2f674f92baf1d90da2d35f10c37df4d9ae139

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# If the last command to run generated an error it will be here.
#

module Gloo
  module Core
    class Error

      attr_accessor :value

      # Set up the error object.
      def initialize
        @value = nil
        @error_count = 0
      end

      # Set the value of error.
      def set_to( new_value )
        @error_count += 1
        @value = new_value
      end

      # Clear out the error message.
      def clear
        @error_count = 0
        @value = nil
      end

      # Start counting errors.
      # We're looking to see if we get any new ones during
      # a script or an immediate command.
      def start_tracking
        @error_count = 0
      end

      # Clear out error if we didn't add any new ones.
      def clear_if_no_errors
        self.clear if @error_count.zero?
      end

      # Get the string representation of the error.
      def to_s
        return @value.to_s
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gloo-0.6.1 lib/gloo/core/error.rb
gloo-0.6.0 lib/gloo/core/error.rb
gloo-0.5.4 lib/gloo/core/error.rb
gloo-0.5.3 lib/gloo/core/error.rb
gloo-0.5.2 lib/gloo/core/error.rb
gloo-0.5.1 lib/gloo/core/error.rb
gloo-0.5.0 lib/gloo/core/error.rb
gloo-0.4.0 lib/gloo/core/error.rb