fork download
  1. class Test
  2. end
  3.  
  4. class Common < Test
  5. class << self
  6. attr_reader :state
  7. end
  8.  
  9. def test_no_id
  10. puts "Inside #{self} it is #{self.class.state}"
  11. end
  12. end
  13.  
  14. class A < Common
  15. @state = "A"
  16. end
  17.  
  18. class B < Common
  19. @state = "B"
  20. end
  21.  
  22. A.new.test_no_id
  23. B.new.test_no_id
  24.  
Success #stdin #stdout 0s 4716KB
stdin
Standard input is empty
stdout
Inside #<A:0x89893bc> it is A
Inside #<B:0x8989358> it is B