Sha256: 5ac440e6163651789f021b8f240241fecc2e4e00cbc1b80117f9f180f8ee5d6f

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

module CachedResource
  # NilIO emulates a null device (like /dev/null). This sort of
  # doesn't belong here, but it's a dependency of cached resource.
  class NilIO < StringIO

    # Write to the null device. Disregards
    # string parameter and returns the length
    # of the string in bytes.
    def write(string)
      string.bytesize
    end

    # Read form the null device.  Always returns nil.
    def read(length=nil, buffer=nil)
      nil
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cached_resource-2.1.3 lib/cached_resource/nilio.rb
cached_resource-2.1.2 lib/cached_resource/nilio.rb
cached_resource-2.1.1a lib/cached_resource/nilio.rb
cached_resource-2.0.1 lib/cached_resource/nilio.rb