Sha256: b77cd67050d95a51ca2c9cd3e935d964bd0fe63eff75b953e7451de32b1e6ca8

Contents?: true

Size: 1.11 KB

Versions: 25

Compression:

Stored size: 1.11 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, :error_count

      #
      # Set up the error object.
      #
      def initialize
        clear
      end

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

      #
      # Set the value of error.
      #
      def set_to( new_value )
        @error_count += 1
        @value = new_value
      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

25 entries across 25 versions & 1 rubygems

Version Path
gloo-3.2.0 lib/gloo/core/error.rb
gloo-3.1.1 lib/gloo/core/error.rb
gloo-3.1.0 lib/gloo/core/error.rb
gloo-3.0.1 lib/gloo/core/error.rb
gloo-3.0.0 lib/gloo/core/error.rb
gloo-2.5.0 lib/gloo/core/error.rb
gloo-2.4.3 lib/gloo/core/error.rb
gloo-2.4.2 lib/gloo/core/error.rb
gloo-2.4.1 lib/gloo/core/error.rb
gloo-2.4.0 lib/gloo/core/error.rb
gloo-2.3.1 lib/gloo/core/error.rb
gloo-2.2.0 lib/gloo/core/error.rb
gloo-2.1.0 lib/gloo/core/error.rb
gloo-2.0.2 lib/gloo/core/error.rb
gloo-2.0.1 lib/gloo/core/error.rb
gloo-2.0.0 lib/gloo/core/error.rb
gloo-0.8.0 lib/gloo/core/error.rb
gloo-0.7.7 lib/gloo/core/error.rb
gloo-0.7.6 lib/gloo/core/error.rb
gloo-0.7.5 lib/gloo/core/error.rb