Sha256: f94f30d98505bbce71543d440ffdb4adb101338c191ae751bd1f75c74cbd7352

Contents?: true

Size: 472 Bytes

Versions: 167

Compression:

Stored size: 472 Bytes

Contents

class String
  @@colorize = false

  class << self
    def colorize=(value)
      @@colorize = value
    end

    def colorize
      @@colorize
    end
  end # of class methods

  Term::ANSIColor::Attribute.named_attributes.map do |attribute|
    class_eval(<<-EOS, __FILE__, __LINE__ + 1)
      def #{attribute.name}
        if @@colorize
          Term::ANSIColor.send(#{attribute.name.inspect}, self)
        else
          self
        end
      end
    EOS
  end
end

Version data entries

167 entries across 167 versions & 11 rubygems

Version Path
eipmap-0.1.4.beta2 lib/eipmap/ext/string_ext.rb
eipmap-0.1.4.beta lib/eipmap/ext/string_ext.rb
miam-0.2.2 lib/miam/ext/string_ext.rb
miam-0.2.2.beta4 lib/miam/ext/string_ext.rb
gratan-0.3.0.beta lib/gratan/ext/string_ext.rb
gratan-0.2.9 lib/gratan/ext/string_ext.rb
gratan-0.2.9.beta3 lib/gratan/ext/string_ext.rb
radiosonde-0.0.8 lib/radiosonde/ext/string_ext.rb
barkdog-0.1.3 lib/barkdog/ext/string_ext.rb
barkdog-0.1.3.beta lib/barkdog/ext/string_ext.rb
miam-0.2.2.beta3 lib/miam/ext/string_ext.rb
miam-0.2.2.beta2 lib/miam/ext/string_ext.rb
lbrt-0.2.1 lib/lbrt/ext/string_ext.rb
lbrt-0.2.0 lib/lbrt/ext/string_ext.rb
lbrt-0.1.9 lib/lbrt/ext/string_ext.rb
lbrt-0.1.8 lib/lbrt/ext/string_ext.rb
lbrt-0.1.7 lib/lbrt/ext/string_ext.rb
miam-0.2.2.beta lib/miam/ext/string_ext.rb
eipmap-0.1.3 lib/eipmap/ext/string_ext.rb
lbrt-0.1.6 lib/lbrt/ext/string_ext.rb