`
lfx_cool
  • 浏览: 66056 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

include and extend

 
阅读更多
Correct Understand:
"extend" adds methods from a module into a class as class methods.
"include" adds methods from a module into a class as instance methods.


It is quite easy to demonstrate this actually.


module SomeModule
  def hi
    puts "hello"
  end
end

class ExtendSample
  extend SomeModule
end

ExtendSample.hi

class IncludeSample
  include SomeModule
end

IncludeSample.new.hi
分享到:
评论

相关推荐

    英文原版-Learning The Vi And Vim Editors 7th Edition

    such as multi-window editing, how to write both interactive macros and scripts to extend the editor, and power tools for programmers — all in the easy-to-follow style that has made this book a ...

    osgi.enterprise-6.0.0

    to tailor and extend the OSGi framework to address information technology software infrastructure use cases found in enterprise scenarios. The EEG technical areas of concern include: • Scaling, ...

    Bootstrap Essentials (pdf)

    As the number of Internet users on mobile devices is growing every ... You will also be able to build and compile Bootstrap from the source code, and nally customize and extend to suit your requirements.

    PostgreSQL Up and Running 2nd 原版PDF by Obe & Hsu

    you can extend it, usually without compiling any code. Not only does it include advanced features, but it also performs them quickly. It can outperform many other databases, including proprietary ones...

    Pro Angular(Apress,Adam Freeman,2ed,2017)

    The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What you’ll learn Gain a solid architectural ...

    Essential TypeScript From Beginner to Pro

    The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What You Will Learn Gain a solid understanding of the ...

    Visual Knowledge Discovery and Machine Learning

    There is a need to extend the class of reversible and lossless n-D data visual representations, for the knowledge discovery in the n-D data. A new class of such representations, called the General ...

    Programming+Python,+4th+Edition(2/2)

    If you’ve mastered Python’s fundamentals, you’re ready to ... More ways to apply Python: Implement data structures, parse text-based information, interface with databases, and extend and embed Python

    Programming+Python,+4th+Edition(1/2)

    If you’ve mastered Python’s fundamentals, you’re ready to ... More ways to apply Python: Implement data structures, parse text-based information, interface with databases, and extend and embed Python

    F# for C# Developers

    Extend your C# skills to F#—and create data-rich computational and parallel software components faster and more efficiently. Focusing on F# 3.0 and Microsoft Visual Studio 2012, you’ll learn how to ...

    Pro Angular 6, 3rd Edition

    Chapters include common problems and how to avoid them. What You’ll Learn Gain a solid architectural understanding of the MVC Pattern Create rich and dynamic web app clients using Angular 6 Use the...

    Pro AngularJS

    The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What you'll learn •Gain a solid architectural ...

    Qt Virtual Keyboard 官方示例代码

    Support for most common input languages, with possibility to easily extend the language support. Left-to-right and right-to-left input. Hardware key support for 2-way and 5-way navigation. Handwriting...

    visual c++2008入门经典 高清pdf电子书

    ❑ You have some knowledge of C++ and you want to extend your C++ skills to include C++/CLI. ❑ You are a newcomer to programming and sufficiently keen to jump in the deep end with C++. To be ...

    Pro Angular, 2nd Edition(pdf英文原版-2017)

    The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What you’ll learn Gain a solid architectural ...

    Pro Angular [ Adam Freeman, 2017, PDF]

    The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What you’ll learn Gain a solid architectural ...

    Big Data-Enabled Nursing_Education, Research and Practice-Springer(2017).pdf

    Introduced throughout all ve parts is the important principle of using partner- ships and building teams that include big data analytics experts and data scientists in order to have the clinical and ...

    Amplify Shader Editor 1.5.5.zip

    While in the current version you can create and extend Surface Shaders, upcoming updates will include dozens of additional shader types, custom lighting models and extended options to help unleash ...

    PICMG 2.5.pdf

    The goal of this specification is to extend the capabilities and utility of the CompactPCI 6U based system architecture to support the application needs of the Computer Telephony (CT) industry, by ...

Global site tag (gtag.js) - Google Analytics