Sha256: 2a2de9c530f4c15bb24cff97cf6c2a6c200bf778e8a979fb40c221dd0b01530f

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

module Rgversion
  class Terminal
    def initialize(command, results)
      @command = command
      @results = results
    end

    def report
      render_errors
      render_output
    end

    def copy_to_clipboard
      return if @output.blank?
      clipboard = Clipboard.new(@output, @command)
      clipboard.copy
    end

    private

    def render_errors
      return if @results[:errors].blank?
      puts @results[:errors].join("\n").red
      puts unless @results[:gems].blank?
    end

    def render_output
      return if @results[:gems].blank?
      @output = @results[:gems].join("\n")
      puts @output
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rgversion-1.1.9 lib/rgversion/terminal.rb
rgversion-1.1.8 lib/rgversion/terminal.rb
rgversion-1.1.7 lib/rgversion/terminal.rb
rgversion-1.1.7.rc1 lib/rgversion/terminal.rb
rgversion-1.1.7.beta2 lib/rgversion/terminal.rb