Join Kevin Skoglund for an in-depth discussion in this video Merge, part of Ruby Essential Training.
In this movie, we are going to take a look at another Ruby method that's going…to make good use of code blocks, and that's Merge.…And Merge is going to be used for merging hashes together, and it's for hashes only.…This is not for arrays, or for ranges or strings or anything else.…This is just a method that we are going to use with hashes.…So let's open up irb with a simple prompt, and let's start out by just declaring a hash.…I am just going to call it h1, real simple. h1 is going to be equal to a, which…will point to the number 111, and let's have b, which will point to the number…222 and that's our first hash.…
Now, let's make a second hash, h2, and in that hash, we are going to have b as a…key for the value 333.…And let's have c as a value for 444.…Now, you can put in just about anything you want here.…The important thing about the two is that you'll notice that b is a key in both…of the hashes, and that's because I want to show you what happens when we merge…them together in that case.…
- 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?
A: E-texteditor.com appears to have gone out of business. On Windows, you should use Sublime (<a target="_blank" href="http://www.sublimetext.com/">http://www.sublimetext.com/</a>) or Notepad++ (<a target="_blank" href="http://notepad-plus-plus.org/">http://notepad-plus-plus.org/</a>) instead.
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.