To understand modules, we first have to understand a little bit about how Ruby works. So, lets define the things that exist in Ruby and see how they work together. Then, we will be able to understand how modules fit into this, and what they are here for.
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
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Returns the result of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
#Vim Cheat Sheet
gqip
- Reformats paragraph to textwidthgq
- Reformats selection:Tab /=
- Equally spaces based on the = symbol (requires Tabular vim plugin):setf language
- Changes current language:set language=language
- Changes current language<C-a>
- Increments the number under the cursor<C-x>
- Decrements the number under the cursor~
- Toggles case and moves to next character in normal mode
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
# Minitest examples | |
# wishful | |
describe Person do | |
describe 'indirect' do | |
subject { Person.new({pet: true}) } | |
it { must_be :pet? } | |
end | |
end |