Sha256: 9223d022924854383fb8f762b6d7e6c241ee6d6ba52e2c1777c7c848642d2bfb

Contents?: true

Size: 824 Bytes

Versions: 4

Compression:

Stored size: 824 Bytes

Contents

module ShellTastic
  class Timer
      def initialize

      end

      # Creates a start time object
      # @param [nil] 
      # @return [Time] Time now object
      def start
        @start_time = Time.now
      end
      
      # Creates a stop time object
      # @param [nil] 
      # @return [Time] Time now object
      def stop
        @stop_time = Time.now
      end

      # Calculates the total time elapsed
      # @see #start and #stop
      # @param [Hash, nil] opts the opts passed in
      # @option [Boolean] milliseconds the time in milliseconds
      # @return [Time] Time elapsed between #start and #stop
      def total_time(milliseconds = false)
        if milliseconds
          (@stop_time - @start_time) * 1000.0
        else
          @stop_time - @start_time
        end
      end
    end
  end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shelltastic-1.0.0 lib/shelltastic/timer.rb
shelltastic-0.5.0 lib/shelltastic/timer.rb
shelltastic-0.4.0 lib/shelltastic/timer.rb
shelltastic-0.3.0 lib/shelltastic/timer.rb