Search Results

Search found 1 results on 1 pages for 'daremarkovic'.

Page 1/1 | 1 

  • Methods specific only to an instance? What are they called in Ruby?

    - by daremarkovic
    I know there are "instance methods", "class methods" but what are these types of methods called, for eg: s1 = "This is my STRING!" def s1.m1 downcase end p s1 # => "This is my STRING!" p s1.m1 # => "this is my string!" What type of method is the "m1" method called on the s1 "instance" of the "string" class? It's really weird because I didn't know this was possible at all if I try: s2 = "This is ANOTHER string" s2.m1 # => Won't work! Which kind of makes sense, but not sure why defining methods like m1 on instances on a class are useful at all.

    Read the article

1