Sha256: a582ac2c047a142732299f7d912a00544c4ad1abb3c2de47be030b6786c2b80b

Contents?: true

Size: 644 Bytes

Versions: 7

Compression:

Stored size: 644 Bytes

Contents

module RSpactor
  module UI
    class << self
      
      def info(message, options = {})
        unless test?
          reset_line if options[:reset]
          clear      if options[:clear]
          puts reset_color(message)
        end
      end
      
      def reset_line
        print "\r\e "
      end
      
    private
      
      def clear
        system("clear;")
      end
      
      def test?
        ENV["RSPACTOR_ENV"] == "test"
      end
      
      def reset_color(text)
        color(text, "\e[0m")
      end
      
      def color(text, color_code)
        "#{color_code}#{text}\e[0m"
      end
      
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rspactor-0.7.0.beta.7 lib/rspactor/ui.rb
rspactor-0.7.0.beta.6 lib/rspactor/ui.rb
rspactor-0.7.0.beta.5 lib/rspactor/ui.rb
rspactor-0.7.0.beta.4 lib/rspactor/ui.rb
rspactor-0.7.0.beta.3 lib/rspactor/ui.rb
rspactor-0.7.0.beta.2 lib/rspactor/ui.rb
rspactor-0.7.0.beta.1 lib/rspactor/ui.rb