Guest User

Untitled

a guest
Apr 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. # Imagine this is fpdf/fpdf_rotate.rb
  2.  
  3. module PDF_Rotate
  4.  
  5. def initialize
  6. @angle = 0
  7. end
  8.  
  9. end
  10.  
  11.  
  12. # Then in some other class:
  13.  
  14. class SomePDF
  15.  
  16. require 'fpdf/fpdf_rotate'
  17. extend(PDF_Rotate)
  18. end
  19.  
  20. foo = SomePDF.new
  21. puts foo.angle
  22.  
  23.  
  24. # angle will be undefined. How to define @angle in the module so that it inherits up to the class?
Add Comment
Please, Sign In to add comment