From: Ronnie Aa Date: 2012-01-23T22:18:27+09:00 Subject: use external .rb file Hello, This is my question: I need to execute the same piece of code in several rb files. I don't want to write it over and over again, so I choose to put that piece of code in an external .rb file and call it in my file like this: require 'shared_classes.rb' module Module1 class Class1 def initialize() Shared_classes::Getfiles.new() puts list_clean[0] end end end This is the external file called 'shared_classes.rb' : module Shared_classes class Getfiles def initialize() Dir.chdir("C:\\Directory\\") d = Dir.getwd listing = Dir.entries(d) list_clean = [] listing.each { |e| if File.ctime(e).to_i > 1326718641 # Get all the newer files list_clean = list_clean.push(e) end } end end end Like this the code doesn't work, the variable 'list_clean' is not transferred... // picked up by my file.. How do I solve this?? Thnx -- Posted via http://www.ruby-forum.com/.