Created
November 27, 2013 20:59
-
-
Save cowboy-cod3r/7683108 to your computer and use it in GitHub Desktop.
Ruby: Metaprogramming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the class type | |
my_obj.class | |
# get the instance methods of a class | |
# false indicates that inherited method should not be included | |
my_obj.class.instance_methods(false) | |
# get instance variables | |
# In ruby, instance variables aren't tied to a class like in java. | |
# They only spring into existence when they are assigned. | |
my_obj.instance_variables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment