From: Aldric Giacomoni Date: 2010-03-20T04:45:05+09:00 Subject: Re: Help with Class definition and calling a Ruby Program Reinhard Lange wrote: > All > I am new to Ruby and to OO programming. > > I need to get the following done which I have written in a function:- > > def SplitCode(sCodeFile,sListFile) [ .............] > end #end of function > > What I need is to be able to pass the arguments to the function and call > it. > Do I need to: > ./mycode.rb file1.txt file2.txt > We don't know enough to really help you. It's a method that's stuck in the middle of other code, and it's not the Ruby way to do things, either. My guess is .. C#, or something like that. Try this code skeleton: def split_code s_code_file, s_list_file File.readlines(s_code_file).each do |line| case line when "&&&&&" when "=====" end # end case end # end readlines end # end method It's a little cleaner. If you don't like the "case" in the middle, then stick to your if/else, which is fine .. If you want to pass arguments to a method from the command line, then those arguments translate inside the Ruby program as an array of strings called ARGV, and you have to do something with those. If you're confused, then it means you're still sane. Give us a little more info. -- Posted via http://www.ruby-forum.com/.