Join Kevin Skoglund for an in-depth discussion in this video Examining file details, part of Ruby Essential Training.
In addition to reading, writing and deleting files, a lot of times we want to…actually just find out some basic information about the file and that's what…we're going to see how to do in this movie.…To demonstrate, I am going to go into irb. Notice I am already in my…ruby_sandbox, simple-prompt.…Before we start, I am going to just assign a variable file equal to a string and…that will be the name of the file, and let's make this that irb_testfile.txt or…you can put any filename you want.…Any file that you know already exists.…We're just going to be checking out information about that file.…
So that's my file, I can then use the string instead of having to type that…all out from now on.…I can just pass the variable file in.…There is a number of class methods on the file class that let us check…out information, File.exist, for example, very handy for finding out if a file exists.…If we want to find out whether it exist before we try to read to it, write it,…rename it, delete it, that's very useful and we'll use that a lot.…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
Q: You mention e-texteditor.com as a place to get a Windows "sister" version of TextMate. However, e-texteditor.com looks like a Chinese auto website. Are there any other alternatives?
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.