Skip to content

Instantly share code, notes, and snippets.

@yinquanteo
Created December 16, 2013 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yinquanteo/7991988 to your computer and use it in GitHub Desktop.
Save yinquanteo/7991988 to your computer and use it in GitHub Desktop.
require 'singleton'
class GlobalThingy
include Singleton
end
GlobalThingy.instance
GlobalThingy.instance.object_id
GlobalThingy.new
require 'forwardable'
class Secretary
def generate_report
"data" * 10
end
end
class Boss
extend Forwardable
def_delegator :@secretary, :generate_report
def initialize(secretary)
@secretary = secretary
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment