Viewing code

B

Burt Hill

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
===================================================================================
 
B

Burt Hill

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top