Ruby Global Property de l'objet

# Get a global property from a Ruby Class

class MyClass
  	# attr_reader makes the @my_global_var accessable in the outside world
	attr_reader :my_global_var
  
  	private
	
  	def initialize
      my_global_var
    end
  
  	def my_global_var
      @my_global_var =|| 'something'
    end
end

my_object = MyClass.new

puts my_object.my_global_var
Arnold Molenaar