Skip to content

Instantly share code, notes, and snippets.

@ainame
Created October 8, 2011 10:47
Show Gist options
  • Save ainame/1272129 to your computer and use it in GitHub Desktop.
Save ainame/1272129 to your computer and use it in GitHub Desktop.
1分で分かるjunemaker/twitterでTwitter#userを呼び出すために行ってる継承等
module Twitter
module Request
def get
puts "Hello Twitter.user!!"
end
end
end
module Twitter
class API
include Request
end
end
module Twitter
class Client < API
module User
def user()
get()
end
end
end
end
module Twitter
class Client
include User
end
end
module Twitter
class << self
def new()
Twitter::Client.new
end
end
end
a = Twitter.new
a.user #=> Hello Twitter.user!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment