Class: Opal::RSpec::DocumentIO

Inherits:
IO
  • Object
show all
Includes:
IO::Writable
Defined in:
opal/opal/rspec/formatter/document_io.rb

Instance Method Summary collapse

Constructor Details

#initializeDocumentIO

Returns a new instance of DocumentIO.



6
7
8
# File 'opal/opal/rspec/formatter/document_io.rb', line 6

def initialize
  `document.open();`
end

Instance Method Details

#closeObject



10
11
12
13
# File 'opal/opal/rspec/formatter/document_io.rb', line 10

def close
  @closed = true
  `document.close()`
end

#flushObject



23
24
# File 'opal/opal/rspec/formatter/document_io.rb', line 23

def flush
end

#write(html) ⇒ Object



15
16
17
18
19
20
21
# File 'opal/opal/rspec/formatter/document_io.rb', line 15

def write(html)
  if @closed
    `console.error(#{"DOC closed, can't write #{html}" })`
  else
    `document.write(#{html})`
  end
end