Sha256: a68eeb18f32074aba9144e6f8bfb87a2963af9b72e91af6298b91cb3a0776a0e

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

module Micronaut
  class RunnerOptions
    
    attr_accessor :color, :formatter
    
    def initialize(options={})
      @color = options.delete(:color)
      @formatter = options.delete(:formatter)
    end
    
    def enable_color_in_output?
      !textmate? && @color
    end
    
    def textmate?
      ENV['TEXTMATE'] || ENV['TM_RUBY']
    end
    
    def output
      $stdout
    end
    
    def formatter
      @formatter_instance ||= case @formatter.to_s
                              when 'documentation'
                                Micronaut::Formatters::DocumentationFormatter.new(self, output)
                              else
                                Micronaut::Formatters::ProgressFormatter.new(self, output)
                              end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spicycode-micronaut-0.0.9 lib/micronaut/runner_options.rb
spicycode-micronaut-0.1.0 lib/micronaut/runner_options.rb