Skip to content

Instantly share code, notes, and snippets.

@sandeep1988
Created February 20, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeep1988/1aed371159c7728cbe2721fff5573c6b to your computer and use it in GitHub Desktop.
Save sandeep1988/1aed371159c7728cbe2721fff5573c6b to your computer and use it in GitHub Desktop.
assignment2
# 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