Skip to content

Instantly share code, notes, and snippets.

@cawel
Created November 19, 2014 22:34
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 cawel/95f6ff6630560869c9b3 to your computer and use it in GitHub Desktop.
Save cawel/95f6ff6630560869c9b3 to your computer and use it in GitHub Desktop.
class Robot
def move(&block)
instance_eval( &block )
end
def up;
puts “u“;
end
def down;
puts “d“;
end
end
robot = Robot.new
robot.move do
up # no need for robot.up()
down # no need for robot.down()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment