Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Learning Ruby

  1. Apr 15, 2008 #1
    I'm learning how to program with Ruby and would like some brains to pick.

    Here's the context:

    class Run_Record
    def initialize
    ##in the future this will be more complicated
    def property(arg)

    p new_run.property(:run_number)

    What do I write in #???? to get the last line to print the run number it gets from the initiation? It seems like there should be a simple way to do this, something that would work kind of like #{arg} inside of strings. I realize that I can accomplish the ultimate task by using the attr_reader method, but I'm curious about whether one could approach the problem this way.
    Last edited: Apr 15, 2008
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted