Skip to content

Instantly share code, notes, and snippets.

@johnbender
Created March 13, 2009 04:45
Show Gist options
  • Save johnbender/78434 to your computer and use it in GitHub Desktop.
Save johnbender/78434 to your computer and use it in GitHub Desktop.
class OperationSerializer
def initialize(op)
@op
end
['==', '>', '>=', '<', '<='].each do |operator|
define_method(operator) do |val|
"#{@op} #{operator} #{val}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment