Class: TestBench::Output::Writer::Substitute::Writer
Constant Summary
Error
Instance Attribute Summary
#byte_offset, #device, #indentation_depth, #mode, #styling, #styling_enabled
Instance Method Summary
collapse
assure_styling_setting, build, #configure, configure, #current?, #decrease_indentation, default_styling_setting, #escape_code, #increase_indentation, #indent, #newline, styling?, styling_settings, #sync, #text, #write
Instance Method Details
#enable_styling! ⇒ Object
31
32
33
|
# File 'lib/test_bench/output/writer/substitute.rb', line 31
def enable_styling!
self.styling_enabled = true
end
|
#pattern(pattern) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/test_bench/output/writer/substitute.rb', line 20
def pattern(pattern)
case pattern
when nil
/./
when String
Regexp.new("\\A#{Regexp.escape(pattern)}\\z")
else
pattern
end
end
|
#written?(pattern = nil) ⇒ Boolean
12
13
14
15
16
17
18
|
# File 'lib/test_bench/output/writer/substitute.rb', line 12
def written?(pattern=nil)
pattern = self.pattern(pattern)
written_text = device.string
pattern.match?(written_text)
end
|