rewrite linker in ruby
linking is idempotent