Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/pseudo-terminal/string.rb

Instance Method Summary collapse

Instance Method Details

#end_with_any?(arr) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/pseudo-terminal/string.rb', line 6

def end_with_any? arr
  r = false
  arr.each {|str| r = true if self.end_with? str }
  r
end

#prepend!(s) ⇒ Object



2
3
4
# File 'lib/pseudo-terminal/string.rb', line 2

def prepend! s
  self.insert 0, s
end

#strip_ansi_escape_sequences!Object



12
13
14
15
# File 'lib/pseudo-terminal/string.rb', line 12

def strip_ansi_escape_sequences!
  self.gsub!(/\e\]\d;(.*)\a/, '')
  self.gsub!(/\e\[[^m]*m/, '')
end