Skip to content

Instantly share code, notes, and snippets.

@STRd6
Last active December 18, 2015 23:39
Show Gist options
  • Save STRd6/5863123 to your computer and use it in GitHub Desktop.
Save STRd6/5863123 to your computer and use it in GitHub Desktop.
+
-
*
/
%
^
|
&
**
<
>
<=
>=
<=>
==
!=
<<
>>
&&
||
Object.defineProperty Object::, "__send__",
value: (message, args...) ->
if @[message]
@[message](args...)
else
@doesNotUnderstand?(message, args...)
Number::["+"] = (other) ->
@ + other
Number::["-"] = (other) ->
@ - other
Number::["*"] = (other) ->
@ * other
Number::["/"] = (other) ->
@ / other
Number::["%"] = (other) ->
@ % other
Number::["|"] = (other) ->
@ | other
Number::["&"] = (other) ->
@ & other
Number::["**"] = (other) ->
Math.pow(@, other)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment