Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Roxy – An Object Proxying Library for Ruby

By Peter Cooper / November 13, 2008

roxy-new.pngWhen you want your objects to refer to / have associations with other objects, it can quickly become a complex procedure. Ryan Daigle to the rescue! Ryan has built Roxy, a "Ruby Proxy-Object Library." He's also put together an awesome blog post with the motivation for developing Roxy and some code examples showing how it works. Roxy gives you the ability to add some rather ActiveRecord-esque functionality to your classes and their instances.

Straight from the horse's mouth:

Roxy is a basic proxy library that lets you quickly create proxies between your ruby objects. Its syntax is loosely based on Association Extensions in ActiveRecord as that is a well-known use of proxies.

Still not convinced to jump straight over to Ryan's blog post? Code example coming up in 3..2..1..:

class Person
  include Roxy::Moxie    

  attr_accessor :first, :last, :parents 

  proxy :parents do
    def divorced?
      proxy_target.size > 1 and proxy_target.collect { |parent| parent.last }.uniq.size > 1

# Can then invoke your proxy methods directly on parents

Supported by: ActionGear is a menu-bar app for task management on your Mac. It's lightweight, quick, and helps you get stuff done. Try it out for free.


  1. Ryan Daigle says:

    Hey Peter, great logo! Can I yank it and use it for Roxy?

  2. Peter Cooper says:

    Noooo.. in fact, I don't think I should even be using it at all and might remove it.

    This is one of those cases where I've done a quick and nasty screenshot from a Google Image result just to get the job done. It turns out this logo belongs to a clothing manufacturer of some sort. While this usage isn't likely to hurt them, they might not be too keen on seeing it used as an actual logo.

    That said, it's an awfully interesting logo because it /looks/ like a Ruby in there, but it's actually a tongue if you see the full thing (at least, I think so).

    So, sorry, but it's not my logo to give away :(

  3. Martin says:

    I'm surprised to see a logo from a brand for surfing clothing for girls for a Ruby library ;-)

  4. Ryan Daigle says:

    Good to hear you're just as fly-by-the-seat-of-your-pants as I, Peter :)

    And Martin - Roxy is a feminine name so the logo _kinda_ makes sense, yeah?

  5. Jacob Swanner says:

    Roxy is the female line of quiksilver clothing (surfing related clothing), that Ruby looking thing is two, mirrored quiksilver logos.

  6. Peter Cooper says:

    Great bit of trivia, Jacob! That logo is pretty cool actually.

    Since it seems to be associated with a big company and I don't fancy getting a C&D anytime soon, I've replaced it with something far worse but free of copyright issues ;-)

  7. Ryan Daigle says:

    That log is downright sexy, Peter.

  8. Ryan Daigle says:

    Crap. ^log^logo.

    That LOGO is down right sexy.

    How unfortunate.

Other Posts to Enjoy

Twitter Mentions