Sha256: b562d57f95894e631479f8c4532abc8da395f2c56da0dc982458107047a8940b

Contents?: true

Size: 298 Bytes

Versions: 2

Compression:

Stored size: 298 Bytes

Contents

class Log
  cattr_accessor :silent

  def self.log(message)
    print message unless silent
  end

  def self.red(text)
    log(colorize(text, 31))
  end

  def self.green(text)
    log(colorize(text, 32))
  end

  private
  def self.colorize(text, code)
    "\033[#{code}m#{text}\033[0m"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid_search-0.2.8 lib/mongoid_search/log.rb
mongoid_search-0.2.7 lib/mongoid_search/log.rb