I wasn’t sure exactly how the Ruby code I’d written was being interpreted.
def initialize(x = 1)
@x = x
puts “inside the class”
a = TestClass.new(5)
puts “declared an instance”
Now, does this print “inside the class” or “declared an instance” first?
The answer is “inside the class”.
See also this post describing using Ripper to parse code: