Class: String

Inherits:
Object show all
Defined in:
lib/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#colorize(color) ⇒ Object



32
33
34
35
# File 'lib/core_ext.rb', line 32

def colorize(color)
  return self if false
  pastel.decorate(self, color)
end

#enquoteObject



24
25
26
# File 'lib/core_ext.rb', line 24

def enquote
  "\"#{to_s}\""
end

#indent(spaces = 2) ⇒ Object



16
17
18
# File 'lib/core_ext.rb', line 16

def indent(spaces = 2)
  lines.map { |line| " " * spaces + line }.join
end

#inline_dcmObject



20
21
22
# File 'lib/core_ext.rb', line 20

def inline_dcm
  "KONSERVIERUNG_FORMAT 2.0\n\n" + self
end

#pastelObject



37
38
39
# File 'lib/core_ext.rb', line 37

def pastel
  @@pastel ||= Pastel.new
end

#present?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/core_ext.rb', line 28

def present?
  !empty?
end