K
Krypt Er
Hello, I am pretty new to ruby although I am a quick learner and have
the benefit of help from a pretty experienced scripter, however with my
tutor being abscent from the forum and IRC channels I think maybe it's
time I started to join a specific forum regarding coding only.
As my first question I would like some help with Zlib (Inflate.inflate +
Defalte.deflate) here is a little snippet of code my tutor gave me a
while ago.
Dir.mkdir("./script") unless File.exist?("./script")
$RGSS_SCRIPTS.each do |s|
s[1] = s[1].gsub(/::/,"_").gsub(/\//, "_")
s[2] = Zlib::Inflate.inflate(s[2])
File.open("./script/#{s[1]}.rb","wb") do |f|
f.print(s[0])
end
end
What this does is it saves all scripts in my program to a new folder in
my project folder called scripts and it outputs them from a data file
into .rb files allowing me to edit the code with notpad++ instead of
using the built in script editor, now this is good however there are
hidden classes and modules that I desperately need to edit as they fall
short of the standard that I should expect, but they are'nt outputed
with the above.
So I did a test to see if the hidden classes and modules are included in
the ruby heap.
ObjectSpace::each_object(Class){|x|
p x
}
Which printed to screen all the usual Zlib, hash, array and also all the
classes I can edit within the editor and listed all the hidden classes
and modules, so my theory is they are contained in the editor and not a
seperate file, I can also with the Zlib code above print to screen about
20 lines of a classes code, but again the hidden classes are well,
hidden, I would like to know if there would be a way.
Is there a way to view hidden classes and modules code, also is it
possible to print to screen more than about 20 lines of a classes code.
the benefit of help from a pretty experienced scripter, however with my
tutor being abscent from the forum and IRC channels I think maybe it's
time I started to join a specific forum regarding coding only.
As my first question I would like some help with Zlib (Inflate.inflate +
Defalte.deflate) here is a little snippet of code my tutor gave me a
while ago.
Dir.mkdir("./script") unless File.exist?("./script")
$RGSS_SCRIPTS.each do |s|
s[1] = s[1].gsub(/::/,"_").gsub(/\//, "_")
s[2] = Zlib::Inflate.inflate(s[2])
File.open("./script/#{s[1]}.rb","wb") do |f|
f.print(s[0])
end
end
What this does is it saves all scripts in my program to a new folder in
my project folder called scripts and it outputs them from a data file
into .rb files allowing me to edit the code with notpad++ instead of
using the built in script editor, now this is good however there are
hidden classes and modules that I desperately need to edit as they fall
short of the standard that I should expect, but they are'nt outputed
with the above.
So I did a test to see if the hidden classes and modules are included in
the ruby heap.
ObjectSpace::each_object(Class){|x|
p x
}
Which printed to screen all the usual Zlib, hash, array and also all the
classes I can edit within the editor and listed all the hidden classes
and modules, so my theory is they are contained in the editor and not a
seperate file, I can also with the Zlib code above print to screen about
20 lines of a classes code, but again the hidden classes are well,
hidden, I would like to know if there would be a way.
Is there a way to view hidden classes and modules code, also is it
possible to print to screen more than about 20 lines of a classes code.