require 'win32ole' module AbsolutePath def self.get_absolute_path(filename) fso = WIN32OLE.new("Scripting.FileSystemObject") return fso.GetAbsolutePathName(filename) end end if __FILE__ == $0 class TestAbsolutePath include AbsolutePath def test_absolute_path full_path = AbsolutePath.get_absolute_path("absolute_path.rb") p full_path end end tap = TestAbsolutePath.new tap.test_absolute_path end クラス内のインスタンスメソッド使った方がいいかも。