All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gems.rainbow-2.0.0.lib.rainbow.wrapper.rb Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
require 'rainbow/presenter'
require 'rainbow/null_presenter'

module Rainbow

  class Wrapper
    attr_accessor :enabled

    def initialize(enabled = true)
      @enabled = enabled
    end

    def wrap(string)
      if enabled
        Rainbow::Presenter.new(string.to_s)
      else
        Rainbow::NullPresenter.new(string.to_s)
      end
    end
  end

end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy