Makers Academy – Intro to Ruby – Day 3 && 4

I have taken the bad habit the last few days of coming into MA a little bit late and not getting as much done as I can. To make up for that I stayed until 8pm this evening, making good use of the quiet room so I was away from the shouts of people playing Ping Pong or Wiff Waff in the main room. I got quite a lot done and concentrated on the “Extra credit” of LearnRubyTheHardWay (an intense but easy, oh the irony, way to learn it).

My proudest moment of the last two days has been managing to whittle 22 lines of code down to just 3 that did exactly the same thing just a lot more efficiently.

  1. from_file, to_file = ARGV
  2. File.open(to_file, “w”).write(File.open(from_file).read())
  3. puts “File #{from_file} has been copied to #{to_file}”

The above code copies one file over another file, these files are input when running the code.

I am certainly learning Ruby the hard way however, but I think that has something to do with the lack of hours I am putting in rather than the content I am using.

p.s. The extra “&” is a geeky joke. Forgive me.