Sha256: f25c416b2c57783ebe097063c45bac3fc0e7b3d64c4ee1c6c4c9b0696b1b9492

Contents?: true

Size: 1.12 KB

Versions: 29

Compression:

Stored size: 1.12 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 GlooLang
  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

29 entries across 29 versions & 1 rubygems

Version Path
gloo-lang-1.4.3 lib/gloo_lang/core/error.rb
gloo-lang-1.4.2 lib/gloo_lang/core/error.rb
gloo-lang-1.4.1 lib/gloo_lang/core/error.rb
gloo-lang-1.4.0 lib/gloo_lang/core/error.rb
gloo-lang-1.3.2 lib/gloo_lang/core/error.rb
gloo-lang-1.3.1 lib/gloo_lang/core/error.rb
gloo-lang-1.3.0 lib/gloo_lang/core/error.rb
gloo-lang-1.2.8 lib/gloo_lang/core/error.rb
gloo-lang-1.2.7 lib/gloo_lang/core/error.rb
gloo-lang-1.2.6 lib/gloo_lang/core/error.rb
gloo-lang-1.2.5 lib/gloo_lang/core/error.rb
gloo-lang-1.2.4 lib/gloo_lang/core/error.rb
gloo-lang-1.2.3 lib/gloo_lang/core/error.rb
gloo-lang-1.2.2 lib/gloo_lang/core/error.rb
gloo-lang-1.2.1 lib/gloo_lang/core/error.rb
gloo-lang-1.2.0 lib/gloo_lang/core/error.rb
gloo-lang-1.1.0 lib/gloo_lang/core/error.rb
gloo-lang-1.0.2 lib/gloo_lang/core/error.rb
gloo-lang-1.0.1 lib/gloo_lang/core/error.rb
gloo-lang-1.0.0 lib/gloo_lang/core/error.rb