The keyword __FILE__ stands for the name of the file containing the code. : FILE « Reflection « Ruby






The keyword __FILE__ stands for the name of the file containing the code.


puts __FILE__

class MyClass
  @@note = 'A'

  def sing_hello
    @@note.succ!.succ!
    print "Hello... ", @@note, " "
  end

 end
myObject = [MyClass.new, MyClass.new, MyClass.new]

myObject.each { |stooge| stooge.sing_hello }

 








Related examples in the same category