Class: String

Inherits:
Object show all
Defined in:
lib/rundock/ext/string.rb,
lib/rundock/ext/object/blank.rb

Constant Summary collapse

BLANK_RE =
/\A[[:space:]]*\z/

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/rundock/ext/object/blank.rb', line 36

def blank?
  self =~ BLANK_RE
end

#just(pad, max) ⇒ Object



2
3
4
5
# File 'lib/rundock/ext/string.rb', line 2

def just(pad, max)
  return self.ljust(max, pad) if length <= max
  return "#{self[0..(max - 3)]}.." if length > max
end