Doubts about ruby

Hi i’ve made an extension for sinatra using datamapper. And I based my
code in some examples that I’ve found in github.
Now, there are some parts of the code that are not very clear:

http://pastie.org/546323

Why do I have to call all this mode … mode … mode to add an
extension to Datamapper::Is module?

http://pastie.org/546324
In line 15. In some way I count how many items does the collection has:

@post = Post.is_paginated
@posts = Post.paginate

How does this block get the type of the collection and the name of the
modoel?
To use this extension I have to call the is_paginated method first. Why
is that? and Is there any automated way to do it?

The complete code of the extension is in here:
http://github.com/malev/sinatra-dm-paginate/tree/master

Thanks for all!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs