Tips for Ruby debugging/practicing

Source: Internet
Author: User

Essential Tools

Irb

Check Ancestors

1.9.3-p545:023 > String.ancestors

= = [String, comparable, Object, Kernel, Basicobject]

String There are four superiors in front of the

Filtration Method

Ruby So many ways that you have to use grep up.

1.9.3-p545:049 > [].methods.grep/^me/

= = [: Member?,: Methods,: Method]

source of the search method

1.9.3-p545:018 > {}.method:select

= #<method:hash#select>

1.9.3-p545:019 > {}.method:reduce

= #<method:hash (Enumerable) #reduce >

Method method can be implemented.

Document

If you find a definite method, you can use RI , convenient and quick.

RI string.sub

Object Model

the principles of the various object languages are similar, but the internal implementation model is different. Ruby is simple to use and it's very complex inside.

When you feel Ruby Good time, in fact, should thank Matz 's work.

Kernel module is the core, There are a lot of important methods in it.

recommended to see the Ruby meta-Programming " , which is described in detail in the book.

Tips for Ruby debugging/practicing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.