Created
October 26, 2012 07:45
-
-
Save maliabadi/3957484 to your computer and use it in GitHub Desktop.
File Two
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
# just assuming that 'file_one.rb' is in your desktop directory. | |
# when you require a file, sometimes you have to specify the exact path of the file you want | |
require '/Users/jen/Desktop/file_one.rb' | |
# Now, all of that shit that was in file_one.rb, is in this file's object space. | |
# So i can do things like. | |
people.each do |person| | |
puts "#{person.first_name} is #{person.youth} years old" | |
end | |
# see? that variable 'people' that we declared in 'file_one.rb' is already there! | |
# Also, we already have the specification for the 'Person' class, so we can go ahead and do shit like this. | |
people << Person.new('robert', 'kelly', 41) # <--- we don't have to redeclare that class again. | |
people.each do |person| | |
puts "#{person.first_name} is #{person.youth} years old" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment