Test Yourself: File Operations


Scroll down...




Some things you should know before moving on.


  • What is "Serialization"?
  • What can you use serialized objects for?
  • What is YAML?
  • What types of files might use YAML?
  • How do you serialize and de-serialize an object in YAML?
  • What is JSON?
  • Where is JSON often used?
  • What do you need to do before you can use JSON in a Ruby project?
  • How do you serialize and de-serialize and object in JSON?

File I/O Basics

  • What actually is a file?
  • What is a "Stream"?
  • What are STDIN and STDOUT?

Working with Files in Ruby

  • What are the file "open modes"?
  • Why should you be sure to close any file you open?
  • How can you read a file without even bothering to (manually) open it?
  • How do you read the contents of a file into an array?
  • How do you write to a file?
  • How can you "save" your objects to a file and then read them back in again?

Regular Expressions

  • How do you set up a regular expression?
  • What are "Regexes" commonly used for?
  • What is a MatchData object and why is it useful?
  • What are "Capture Groups" and why are they useful?
  • How do you return an array of all matches?
  • How do you use a regex to substitute a pattern with a string?

Sign up to track your progress for free


There are no additional resources for this lesson just yet!

Sorry, comments aren't active just yet!

Next Lesson: Dictionary Reader