lib/care.rb
# Returns at most `n_bytes` of data from the IO or less if less data was available
# before the EOF was hit
#
# @param n_bytes[Integer]
# @return [String, nil] the content read from the IO or `nil` if no data was available
Returns at most `n_bytes` of data from the IO or less if less data was available
before the EOF was hit
Returns at most ` n_bytes ` of data from the IO or less if less data was available before the EOF was hit
def read(n_bytes)
      return '' if n_bytes == 0 
      raise ArgumentError, "negative length #{n_bytes} given" if n_bytes < 0 
      read = @cache.byteslice(@io, @pos, n_bytes)
      return unless read && !read.empty?
      @pos += read.bytesize
      read
    end
def read ( n_bytes ) return '' if n_bytes == 0 raise ArgumentError , "negative length #{n_bytes} given" if n_bytes < 0 read = @cache . byteslice ( @io , @pos , n_bytes ) return unless read && ! read . empty? @pos += read . bytesize read end
Returns at most `n_bytes` of data from the IO or less if less data was available
before the EOF was hit
Returns at most ` n_bytes ` of data from the IO or less if less data was available before the EOF was hit
# As hardcoded for all Ruby IO objects # also as per Ruby IO objects
the content read from the IO or `nil` if no data was available
the content read from the IO or ` nil ` if no data was available
String, nil
n_bytes
None