Module: IOizeString

Defined in:
lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tellObject (readonly)

Returns the value of attribute tell.



17
18
19
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb', line 17

def tell
  @tell
end

Instance Method Details

#read(count = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb', line 19

def read(count = nil)
  @tell ||= 0
  count = size unless count
  retVal = slice(@tell, count)
  @tell += count
  return retVal
end

#resetObject



46
47
48
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb', line 46

def reset
  @tell = 0
end

#seek(index, offset) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hotplate/gems/rubyzip-1.1.7/test/test_helper.rb', line 27

def seek(index, offset)
  @tell ||= 0
  case offset
  when IO::SEEK_END
    newPos = size + index
  when IO::SEEK_SET
    newPos = index
  when IO::SEEK_CUR
    newPos = @tell + index
  else
    raise "Error in test method IOizeString::seek"
  end
  if (newPos < 0 || newPos >= size)
    raise Errno::EINVAL
  else
    @tell=newPos
  end
end