Thursday 15 September 2011

Is there a name for the Ruby syntax shared by attr methods, ActiveRecord associations, the "content_type" Sinatra property, etc.? -


I have seen that these three "things" use the same syntax, i.e. "name1" after a symbol:

Example 1:

  attr_reader: methodname   

Example 2:

  before_create: didisthing   

Example 3:

  content_type: json   

Is using this to refer to this syntax pattern I can?

I have referred to them as 'square macros', especially in terms of rail, but they All are essentially class methods that write other class or installation methods (i.e. metaprogramming).

No comments:

Post a Comment