Class: IOStub

Inherits:
String show all
Defined in:
lib/mspec/helpers/io.rb

Instance Method Summary collapse

Instance Method Details

#flushObject



24
25
26
# File 'lib/mspec/helpers/io.rb', line 24

def flush
  self
end


8
9
10
# File 'lib/mspec/helpers/io.rb', line 8

def print(*str)
  write(str.join + $\.to_s)
end

#printf(format, *args) ⇒ Object



20
21
22
# File 'lib/mspec/helpers/io.rb', line 20

def printf(format, *args)
  self << sprintf(format, *args)
end

#puts(*str) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/mspec/helpers/io.rb', line 12

def puts(*str)
  if str.empty?
    write "\n"
  else
    write(str.collect { |s| s.to_s.chomp }.concat([nil]).join("\n"))
  end
end

#write(*str) ⇒ Object



4
5
6
# File 'lib/mspec/helpers/io.rb', line 4

def write(*str)
  self << str.join
end