Executing a line of code in a ruby file


Is there a way to execute a line of code in a ruby file directly in the editor like textmate does?  For example take this code:


class Point

  def self.my_new_instance(*args, &block)
    instance = allocate
    instance.my_initialize(*args, &block)

  def my_initialize(x, y)
    @x = x
    @y = y

p = Point.my_new_instance(3, 4)  # => #<Point:0x007fb0b085f148 @x=3, @y=4>

I would like to see the last line above spit out what I am showing you after the # is this possible rather than having to run the run button.


Please sign in to leave a comment.