Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rubyc

Martin Chabot
September 20, 2012

 Rubyc

Rubyc helps you at the command line

Martin Chabot

September 20, 2012
Tweet

Other Decks in Programming

Transcript

  1. Unix Tools • grep • find • xargs • sed

    • awk • ... Thursday, 20 September, 12
  2. Do you need to look at documentation to use sed

    & awk? Thursday, 20 September, 12
  3. Ruby 1.8 • Can only have one -r option •

    You cannot use it with rubygems Thursday, 20 September, 12
  4. Ruby 1.9 • Can only have many -r options •

    eg: -r rubygems -r csv Thursday, 20 September, 12
  5. Rubyc Gem • Supports Enumerable methods: map, select etc. •

    Iterates on each line • Sets the ‘line’ variable and its ‘l’ alias • Sets the ‘lnum’ and the ‘index’ variable Thursday, 20 September, 12
  6. The shell way rake 2> >(while read line;do echo -e

    "\033[31m$line \033[0m";done) Thursday, 20 September, 12
  7. The Ruby 1.9 Way rake 2> >(ruby -r colorize -p

    -e ‘$_ = $_.red’) Thursday, 20 September, 12
  8. Use Case II Extract the number of insertions per db

    table in a Rails log file Thursday, 20 September, 12
  9. The Shell Way To lazy to work on it !

    Thursday, 20 September, 12
  10. Conclusion • If you feel confortable with ruby’s -n -p

    options continue using it. • If your like me, give Rubyc a chance. • Give me some feedback Thursday, 20 September, 12