Skip to content

Instantly share code, notes, and snippets.

@carlesso
Created February 21, 2015 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlesso/e27b362e5b9bd8d69b3b to your computer and use it in GitHub Desktop.
Save carlesso/e27b362e5b9bd8d69b3b to your computer and use it in GitHub Desktop.
Pry show-method applied to .=~
[16] pry(main)> show-method 'string'.=~
From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 14
static VALUE
rb_str_match(VALUE x, VALUE y)
{
switch (TYPE(y)) {
case T_STRING:
rb_raise(rb_eTypeError, "type mismatch: String given");
case T_REGEXP:
return rb_reg_match(y, x);
default:
return rb_funcall(y, rb_intern("=~"), 1, x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment