Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
Last active August 29, 2015 13:57
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 chris-ramon/9495430 to your computer and use it in GitHub Desktop.
Save chris-ramon/9495430 to your computer and use it in GitHub Desktop.
:D dsl drone
def drone
puts 'start controlling drone'
yield
end
def fly
puts 'flying'
yield if block_given?
end
def move direction
puts "moving #{direction.to_s}"
yield if block_given?
end
def atack
puts "atacking"
end
drone do
fly do
move :forward do
move(:right) { atack }
move(:left) { atack }
end
end
end
drone { fly; move :forward; atack }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment