你们在做 Ror 项目的时候都是如何调试的? Ror 支持断点调试么?怎么样做,需要安装什么工具? 新手在此谢过~
@ken @hooooopo 谢谢二位仁兄~!不得不说 byebug 略胜一筹! 二位有没有适合入门的源码?比如一个登陆的 demo 或者是注册的 demo,给个链接或者直接邮箱我,谢谢~ 邮箱:[email protected]
大家都好猛。。。。
我是 irb + log + 单元测试
irb 主要去试一些我记得不太清楚的 ruby 语法
log 一般就是看某时候某变量的具体值
我喜欢用
p "xxxxxx"
最后单元测试 model 看是否符合预期
$ pry
[1] pry(main)> show-method Array#each
From: array.c (C Method):
Owner: Array
Visibility: public
Number of lines: 12
#=>
VALUE
rb_ary_each(VALUE array)
{
long i;
volatile VALUE ary = array;
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
for (i=0; i<RARRAY_LEN(ary); i++) {
rb_yield(RARRAY_AREF(ary, i));
}
return ary;
}
[6] pry(main)> cd Array
[7] pry(Array):1> ls
Array.methods: [] columnize_opts columnize_opts= try_convert
Array#methods:
& bsearch delete_at first last push rotate slice! uniq
* clear delete_if flatten length rassoc rotate! sort uniq!
+ collect drop flatten! map reject sample sort! unshift
- collect! drop_while frozen? map! reject! select sort_by! values_at
<< combination each hash pack repeated_combination select! take zip
<=> compact each_index include? permutation repeated_permutation shelljoin take_while |
== compact! empty? index place replace shift to_a
[] concat eql? insert pop reverse shuffle to_ary
[]= count fetch inspect pretty_print reverse! shuffle! to_h
assoc cycle fill join pretty_print_cycle reverse_each size to_s
at delete find_index keep_if product rindex slice transpose
instance variables: @columnize_opts
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_
[8] pry(Array):1> whereami
Inside Array.
[9] pry(Array):1>
http://przemekmroczek.com/post/106717411075/5-killer-ruby-talks-of-2014 第二个视频。Debugger driven development — Beginner