https://github.com/jsuereth/evil_monkey
Because sometimes you need an evil monkey to do it.
https://github.com/jsuereth/evil_monkey
Last synced: 11 months ago
JSON representation
Because sometimes you need an evil monkey to do it.
- Host: GitHub
- URL: https://github.com/jsuereth/evil_monkey
- Owner: jsuereth
- Created: 2014-04-05T01:48:49.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-05T01:49:43.000Z (about 12 years ago)
- Last Synced: 2025-03-20T10:18:17.049Z (about 1 year ago)
- Language: Scala
- Size: 105 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Evil Monkey #
Because sometimes you're working with legacy code and there is no better way.
Might as well enjoy it while doing evil.
## Examples ##
Note: All these methods are private, final, static or all three.
```scala
$ sbt test:console
scala> val cls = com.jsuereth.evil.Monkey.static[Evil]
cls: com.jsuereth.evil.StaticMonkey = com.jsuereth.evil.StaticMonkey@517e109e
scala> cls.bar[Int]
res9: Option[Int] = Some(2)
scala> val monkey = com.jsuereth.evil.Monkey(new Evil())
monkey: com.jsuereth.evil.Monkey = com.jsuereth.evil.Monkey@2587053f
scala> monkey.foo[Int]
res10: Option[Int] = Some(1)
scala> monkey.foo = 3
monkey.foo: Option[Nothing] = Some(3)
scala> monkey.dumb("Hello")
DUMB!!! Hello
res11: Option[Nothing] = Some(null)
scala> monkey.dumb2[String]("Hello, Again")
res12: Option[String] = Some(Hello, Againmore)
```