public
Description: my random codes
Homepage: http://anilwadghule.com/blog
Clone URL: git://github.com/anildigital/anil-code.git
anil-code / meta_quiz1.rb
100644 15 lines (11 sloc) 0.25 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Print hello world from outside of class
class Greeting
  class << self
    def self.hello
      puts "Hello World!"
    end
  end
 
  # this line is the solution
  def self.meta; class << self; self.superclass; end; end
 
end
 
Greeting.meta.hello