The first step is to define what we are looking for. Let's say we want to find out all the attributes that a person has. We can do so by using the following code:
- attributes = Object . new . class_eval do def attribute? ( attr ) attr == self end end
- Then, we need to write our actual code that finds out all the attributes of someone's name:
- name = "John"
Share a personalized message with your friends.