Sha256: a63e6a4eecae5a14f7eac459cd1bb4bad07b39c5cea5149b265ec1a22d07aa5b

Contents?: true

Size: 785 Bytes

Versions: 46

Compression:

Stored size: 785 Bytes

Contents

class IOStub < String
  def write(*str)
    self << str.join
  end

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

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

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

  def flush
    self
  end
end

class Object
  # Creates a "bare" file descriptor (i.e. one that is not associated
  # with any Ruby object). The file descriptor can safely be passed
  # to IO.new without creating a Ruby object alias to the fd.
  def new_fd(name, mode="w:utf-8")
    IO.sysopen name, fmode(mode)
  end

  # Creates an IO instance for a temporary file name. The file
  # must be deleted.
  def new_io(name, mode="w:utf-8")
    IO.new new_fd(name, fmode(mode)), fmode(mode)
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
rhodes-5.5.18 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/helpers/io.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/helpers/io.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/helpers/io.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.5.1.12 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.5 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.4.2 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.4 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.3 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.3.beta.4 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.3.beta.3 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.3.beta.2 lib/extensions/mspec/mspec/helpers/io.rb
rhodes-3.3.3.beta.1 lib/extensions/mspec/mspec/helpers/io.rb