Created
January 20, 2015 10:02
-
-
Save launchkit-codes/defaf0416629bf839445 to your computer and use it in GitHub Desktop.
Return a Class in Ruby
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
| class Hello | |
| def self.world | |
| puts 'Hello World !' | |
| end | |
| end | |
| def return_hello | |
| return Hello | |
| end | |
| return_hello.world | |
| # Output: | |
| # | |
| # $> ruby return_a_class.rb | |
| # Hello World ! | |
| # $> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment