-
-
Save sandeep1988/1aed371159c7728cbe2721fff5573c6b to your computer and use it in GitHub Desktop.
assignment2
This file contains 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
# Example 1: | |
class User | |
["active", "inactive","pending"].each do |method| | |
define_method "#{method}?" do | |
self.status == method | |
end | |
end | |
end | |
============================== | |
###Test Case | |
@user = User.last | |
@user.active? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment