Reflection can inspect, analyze, and modify itself.
Ruby allows you to change the functionality of the language itself while running your own code.
It's possible to query almost any object within Ruby for the methods that are defined within it.
a = "This is a test" puts a.methods.join(' ')
instance_variables returns the names of any object variables associated with an instance as opposed to class variables:
class Person attr_accessor :name, :age # www .ja v a 2s . c om end p = Person.new p.name = "Fred" p.age = 20 puts p.instance_variables