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
<!-- same as above --> | |
<router-link :to="{ path: 'foo' }">Foo</router-link> | |
<!-- named route --> | |
<router-link :to="{ name: 'foo', params: { foo: 'bar' }}">Foo</router-link> |
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
class Word | |
def initialize(word) | |
@letters = word.split('').map do |letter| | |
{ | |
:letter => letter, | |
:hidden => true | |
} | |
end | |
end |
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
trains = { | |
"L Train" => "8th Ave, 6th Ave, Union Square, 3rd Ave, 1st Ave, Bedford Ave", | |
"N Train" => "Times Square, Herald Square, 28th St, 23rd St - HMH Nexus, Union Square, 8th Ave", | |
"6 Train" => "Grand Central, 33rd St, 28th St, 23rd St, Union Square, Astor Place" | |
} | |
loop do | |
puts "To view all train lines, type lines." | |
puts "To view all stations for line, type stations." |
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
What were some of the issues with your first iteration of HMH Rail? | |
- It took way longer than it should have, considering its length. I got completely lost somewhere between steps 3 and 4. | |
Is there a lot of repeated code? | |
- Yes, for each if/eslif/else I repeated the same three lines of code. I also repeated the “You selected the __ train” string three times, which could possibly be replaced with a method that contains something along the lines of ‘puts “You selected the #{ } train.”’ I also repeated the string stating the stations options twice. | |
How flexible is the code? | |
- The code was not flexible at all. There was no way to add extra train lines and corresponding stations. | |
Where do you see room for improvement? | |
- All over the place to be honest. | |
What are the nouns for this problem domain? What real-world objects are we trying to represent through our code? | |
- Train lines, train stations. |
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
def main_menu | |
puts "List train lines (T)? List Stations (Sta)? Quit program (Q)? Please make a selection." | |
end | |
loop do | |
main_menu | |
answer = gets.chomp.to_s | |
if answer == "T" |
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
loop do | |
puts "List train lines (T)? List Stations (Sta)? Quit program (Q)? Please make a selection." | |
answer = gets.chomp.to_s | |
if answer == "T" | |
puts "The (L) Train, The (N) Train, The (S)ix Train" | |
elsif answer == "Sta" | |
puts "The (L) Train, The (N) Train, The (S)ix Train Choose a train line by letter." |
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
loop do | |
puts "The (L) Train, The (N) Train, The (S)ix Train" | |
puts "Do you wish to quit?" | |
continue = gets.chomp | |
if continue == "Yes" | |
puts "Thank You" | |
break | |
else | |
puts "Choose a train line by letter." | |
end |
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
puts "The (L) Train, The (N) Train, The (S)ix Train" | |
puts "Choose a train line by letter." | |
selection = gets.chomp.to_s | |
if selection == "L" | |
puts "You selected the L train." | |
puts "8th Ave, 6th Ave, Union Square, 3rd Ave, 1st Ave, Bedford Ave" | |
elsif selection == "N" | |
puts "You selected the N train." | |
puts "Times Square, Herald Square, 28th St, 23rd St - HMH Nexus, |
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
puts "The (L) Train, The (N) Train, The (S)ix Train" | |
puts "Choose a train line by letter." | |
selection = gets.chomp.to_s | |
if selection == "L" | |
puts "You selected the L train." | |
elsif selection == "N" | |
puts "You selected the N train." | |
elsif selection == "S" | |
puts "You selected the Six Train." |