Ruby is fully object oriented language. In ruby, everything is an object & therefore, belongs to some class. for example 5
belongs to Object class
1.9.3p194 :001 > 5.class
=> Fixnum
1.9.3p194 :002 > 5.class.superclass
=> Integer
1.9.3p194 :003 > 5.class.superclass.superclass
=> Numeric
1.9.3p194 :005 > 5.class.superclass.superclass.superclass
=> Object
1.9.3p194 :006 > 5.class.superclass.superclass.superclass.superclass
=> BasicObject
1.9.3p194 :007 > 5.class.superclass.superclass.superclass.superclass.superclass
=> nil
so, we have to call all methods by prefixing class/object name as in Object_name#method_name
. example:
5.times{|i| puts i}
now, rails has these so called helpers like stylesheet_link_tag
, javascript_include_tag
, form_for
etc which do follow this Object_name#method_name
syntax, so i guess they are just normal functions.
so my question is
- What are these rails helpers?
- If they just functions & do not
inherit from any class. Doesn't that contradict the claim made
saying - in ruby,
everything a object & there are no primitives
. As the example, people cite5.+(6)
saying even operators are just plain methods?