Module: TarkaMatchers::Helpers::Expectation::Common

Constant Summary collapse

SGR =
/\\e\[(?:10[0-7]|0{1,2}\d|0{0,1}\d\d|\d)m/
NEWLINE =
/\\n/

Instance Method Summary collapse

Instance Method Details

#clean!(string) ⇒ Object



17
18
19
20
21
# File 'lib/tarka_matchers/helpers/expectation/common.rb', line 17

def clean! string
  string.gsub!(SGR,'') unless @keep_sgrs
  string.gsub!(NEWLINE,'') unless @keep_newlines
  string
end

#keep_newlinesObject



12
13
14
15
# File 'lib/tarka_matchers/helpers/expectation/common.rb', line 12

def keep_newlines
  @keep_newlines = true
  self
end

#keep_sgrsObject



7
8
9
10
# File 'lib/tarka_matchers/helpers/expectation/common.rb', line 7

def keep_sgrs
  @keep_sgrs = true
  self
end