• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

I added a new feature to irb_rocket.
It's a simple utility for ease of daily irb use.
Have you ever felt annoying for typing left cursor to enclose exprs by parens to be receiver like this?

ruby>>
irb> 1 + 2 + 3 # Oh, I want to call "to_s"
irb> (1 + 2 + 3 # back to the head
irb> (1 + 2 + 3).to_s # return to the tail
<<--

I've experienced stuffs like this very often.
Very annoying.

So I added the new feature named "irb_dollar"
Its usage is simple, like this.

ruby>>
irb> require "irb_dollar"
irb> 1 + 2 + 3 $ to_s #=> "6"
<<--

Nice!

You can use "$" sign to make the left hand statement be receiver by installing irb_rocket version that is newer than 0.2.0

Enjoy :)

Links

posted by genki genki on Mon 3 Jan 2011 at 18:56 with 0 comments