title: [Ruby]: Passing a Class instance member value to another Class function
body: <p>I am writing a program to read files and search text in it. I have written the first initial steps. In the below given code you can see a symbol ** -- **. This where I want to pass member variable value of Class [CurrentFile].</p>
  
  <p>Please also suggest what improvements I can do in this code.</p>
  
  <pre><code>class CurrentFile
      attr_accessor :currentFileName, :currentFileContent
    end
  
  class OpenFile &lt; CurrentFile
      def OpenFileToRead()  #Open file as read-only.
        thisFile = File.open(** ----- **, 'r')
        counter = 1
  
          begin
            file = File.new(thisFile, "r")
            while (line = file.gets)
              puts "#{counter}: #{line}"
              counter = counter + 1
            end
            file.close
          rescue =&gt; err
            puts "Exception: #{err}"
            err
          end #End of Begin block
      end #End of OpenFileToRead
    end #End of Class: OpenFile
  
  fileToRead = CurrentFile.new #Create instance of CurrentFile Class
  fileToRead.currentFileName = "C:\WorkSpace\SearchText\abc.php" #Set file name to read
  myFile = OpenFile.new #Create instance of OpenFile Class
  </code></pre>