Skip to content

Instantly share code, notes, and snippets.

@mculp
Created October 3, 2012 16:10
Show Gist options
  • Save mculp/3827906 to your computer and use it in GitHub Desktop.
Save mculp/3827906 to your computer and use it in GitHub Desktop.
irb(main):001:0> directions = %w[DESC ASC]
=> ["DESC", "ASC"]
irb(main):002:0> directions.instance_eval { def toggle(direction); self - [direction]; end }
=> nil
irb(main):003:0> directions.toggle('ASC')
=> ["DESC"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment