vendredi 9 décembre 2016

How can I achieve this result in ruby?

I was reading the Sequel's docs and I'm got curious about the technique used in the following code snippet:

class Post < Sequel::Model(:my_posts)
  (...)
end

The Sequel::Model(:my_posts) sets the database table for the model. I'm curious specifically about the parenthesis in Model(:my_posts). I like this interface, but how can I achieve that? It's a bit weird... Seems like the Model can be called as a method... Which is this technique? Can somebody give me an example?

Aucun commentaire:

Enregistrer un commentaire