Sha256: b1805b789be05329523c1e009eba450148b8446de87f8a5e8f50d59c5e31ab7f

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require_relative 'helper'

module HerokuRailsSaas
  class Displayer
    class << self
      # Prepends a string output with a label consisting of the app name and a color code.    
      def labelize(message="", new_line=true, remote_name, color)
        message = "[ #{Helper.send(color, remote_name)} ] #{message}"
        message = message + "\n" if new_line && message[-1] != "\n"
        $stdout.print(message)
        $stdout.flush
      end
    end

    def initialize(remote_name, color)
      @remote_name = remote_name
      @color = color
    end

    attr_reader :color, :remote_name

    def labelize(message="", new_line=true)
      self.class.labelize(message, new_line, @remote_name, @color)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heroku-rails-saas-1.0.3 lib/heroku-rails-saas/displayer.rb
heroku-rails-saas-1.0.2 lib/heroku-rails-saas/displayer.rb