Viewing code

I am new to ruby and although I am learning quickley I was wondering if
it is possible to view code, I will explain.

When I write a module I can use the below code to print out the method
names I used in my module on screen which is ok, but is it possible to
print everything I written (the whole script) onscreen and/or
output/save it to a txt file?

module Hidden
class << self
p instance_methods-Module.instance_methods
end
end

Ok I found a better way of explaining it.

Say I write a module for a program and I implement it and it all works
fine but later I want to add onto it but I can no longer remember what I
written in and the module itself is not visible within the program.

When I use the above code in my first post it returns the methods I
wrote in arrays but nothing else, then the program continues as normal
this isn’t too bad as it helps me remember what methods I used, but, I
still need to know everything else so instead of taking ages deciphering
and remembering what else I wrote is it possible to print to screen or
output the whole script into a .txt document.

Problem is I didn’t make a copy of my module and now the module is there
and working but I want to add to it without deciphering and without
adding a new module with aliases.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs