Your SlideShare is downloading. ×
Module singleton
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Module singleton

604
views

Published on

How a ruby module is actually a singleton... and how you can use this for great good. …

How a ruby module is actually a singleton... and how you can use this for great good.

Note: these slides make almost no sense without narration. That's intentional.

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
604
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. module == “singleton”(sometimes)
  • 2. module == “singleton”(sometimes)
  • 3. 3
  • 4. 1. static
  • 5. 2. singleton
  • 6. 3. class
  • 7. Singleton module
  • 8. Singleton module
  • 9. class Matt include Singletonend
  • 10. module
  • 11.

  • 13. module Matt extend selfend
  • 14. Extend self? WTF?
  • 15. extendv.include
  • 16. module Matt extend selfattr_accessor :handledef handle @handle ||= “moonmaster9000” endend
  • 17. Matt = Module.new doattr_accessor :handledef handle @handle ||= “moonmaster9000” endendMatt.extend Matt

×