Skip to content

Instantly share code, notes, and snippets.

@draegtun
Created December 20, 2010 17:11
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 draegtun/748656 to your computer and use it in GitHub Desktop.
Save draegtun/748656 to your computer and use it in GitHub Desktop.
Charging Objects in Io
# Charging Objects in Io
#
# See "Charging Objects in Ruby"
# - http://timeless.judofyr.net/charging-objects-in-ruby
# - http://news.ycombinator.com/item?id=2022107
Rules := Object clone do (
rules := list()
+ := method (obj,
obj setCharge("positive")
rules append(obj)
obj
)
- := method (obj,
obj setCharge("negative")
rules append(obj)
obj
)
url := method (value,
Rule clone setKind("url") setValue(value)
)
run := method (
rules foreach (println) # just print for now
)
)
Rule := Object clone do (
kind ::= nil
value ::= nil
charge ::= "neutral"
)
Rules do (
+ url("http://timeless.judofyr.net/*")
- url("http://timeless.judofyr.net/")
- url("http://timeless.judofyr.net/changelog/*")
)
Rules run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment