polymorphic ruby code.