-
-
Save havenwood/210cb16f163ddfd1de71f7ad0ff8ec59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Window < IO | |
SEEK_LINE = 2 | |
def self.for_fd(...) | |
super(...).tap { _1.seek SEEK_LINE } | |
end | |
end | |
example_io = File.open 'example.io' | |
window = Window.for_fd example_io.fileno | |
window.readline | |
#=> "Second line ..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment