SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick Class Question

    So, basically, to print out a class we just call it

    newclass=Class.new

    then

    print newclass.method

    Am I missing anything? Also, does 'NoMethodError' (in the printout) mean nothing went wrong? I'm just making sure.*

    Thanks.

    * 2 questions, I lied

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That works if the method returns a value, object, etc...
    Anything with <blahblah>Error means something went wrong. In this case, the class does not have the method you are calling. You will have to a)define it or b)choose one that already exists. You can find a list of classes and methods that exist at http://ruby-doc.org/.

  3. #3
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was there. I actually edited the post. Originally I thought my class examples (from another tutorial, though) was using old code - then I realized I needed to print the results after. :/

    The problem is the forum didn't let me edit the title of the thread. TY, for your time.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •