Ruby: Files, Formats, Templates

Ruby: Files, Formats, Templates
Ruby: Files, Formats, Templates
English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 2h 27m | 346 MB

Discover how to use Ruby code to interact with the file system. With Ruby, you can read and write to config files and logs, automate tasks like mail merge, and find and organize files without ever leaving your code editor. In this course, the third in the Ruby Essential Training series, Kevin Skoglund reviews the basic techniques for working with files and directories. Learn to find existing files and directories and to create new ones. Discover different techniques for reading and writing data to files. Then learn how to import and export data in popular formats and how to use Embedded Ruby (ERB) to bind dynamic values into reusable file templates. Each lesson is filled with practical examples, and programming challenges allow you to practice your new skills as you progress through the course.

Topics include:

  • File system basics
  • Writing to and reading from files
  • Renaming, deleting, and copying files
  • Creating and editing directories
  • Working with common data formats
  • ERB templating
Table of Contents

1 Learn the essentials of working with files in Ruby
2 What you need to know

The File System
3 Input output basics
4 File system basics
5 Types of file paths
6 File permissions

Work with Files
7 Access files
8 Write to files
9 Read from files
10 File pointer
11 Read or write an entire file
12 Rename delete copy
13 Examine file details
14 Challenge – List maker
15 Solution – List maker

Work with Directories
16 Create directories
17 Change directories
18 Entries
19 Glob
20 Challenge – Multi-list maker
21 Solution – Multi-list maker

Common Data Formats
22 CSV
23 CSV to hashes
26 XML

ERB Templating
27 Embed Ruby
28 Binding
29 Template files
30 Challenge – Mail merge
31 Solution – Mail merge

32 Next steps