Forum: Ruby Difference of Module#included and Module#extended and Module#prepended

Posted by Love U Ruby (my-ruby)
on 2013-03-13 13:23
Can anyone help me to understand the below 3 methods about their
functional differences and uses?

  Module#included

  Module#extended

  Module#prepended

Thanks
Posted by Hans Mackowiak (hanmac)
on 2013-03-13 13:43
mod.included(other) is called after other.include(mod)
mod.extended(obj) is called after obj.extend(mod)
mod.prepended(other) is called after other.prepend(mod)


they are Hook or Callback methods.



AND YOU ARE TO LAZY TO USE RI!!

ri included

#=> ***Callback invoked whenever the receiver is included in another 
module or class.***
Posted by Love U Ruby (my-ruby)
on 2013-03-13 14:05
@Hans Module#extended not documented - 
http://www.ruby-doc.org/core-2.0/Module.html#metho...

And in my console `ri` doesn't work. I don't know why. :(

C:\>ri prepended
Nothing known about .prepended

C:\>ri extended
Nothing known about extended
Posted by D. Deryl Downey (ddd)
on 2013-03-13 14:43
Attachment: compose-unknown-contact.jpg (770 Bytes)
(Received via mailing list)
Probably because if you're using RVM, you didn't run 'rvm docs generate'
like the instructions dictate. Check whatever ruby manager or ruby
packages you're using have to say about building the ri/rdoc docs.


> C:\>ri extended
>
> Module#prepended
>
> Thanks
>

--
D. Deryl Downey

  "The bug which you would fright me with I seek" - William Shakespeare
- The Winter's Tale, Act III, Scene II - A court of Justice.
Posted by Love U Ruby (my-ruby)
on 2013-03-13 19:46
Today I just installed. ruby 2.0 windows version
but i am getting something different with it

C:\>irb --simple-prompt
DL is deprecated, please use Fiddle
>> p "hi"
"hi"
=> "hi"

Can anyone tell me why I am being said that to use fiddle?
Posted by John W Higgins (Guest)
on 2013-03-13 21:16
(Received via mailing list)
On Wed, Mar 13, 2013 at 11:46 AM, Love U Ruby <lists@ruby-forum.com> 
wrote:

>
>
Maybe because DL is deprecated?

John
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.