Skip to content

#eof? method returning wrong value when it's used on a csv file #258

@Jee-El

Description

@Jee-El

Ruby version : 3.1.2p20, as well as 2.7.4p191 (replit)
Steps to reproduce the issue(?) :

  • Open a csv file with CSV.open('file.csv')
  • Call #pos on it, it returns 0
  • Call #eof? on it, it returns false
  • Call #read on it
  • Call #pos on it, it returns the last position
  • Call #eof? on it, it returns false when it should be true

It seems to return true if #eof? isn't called before reading the file. (i.e: omit the third line above)

Demonstration : https://replit.com/@Jee-El/Ruby-CSV-eof-issue?v=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions