Currently, trying to sort a set or array of Spira resources results in the error:
undefined method `<=>' for #<MyClass:0x1020aa638>
To make this work, Spira::Base ought to mix in Comparable and implement a default #<=> method. An example implementation follows:
# @param [Spira::Resource] other
# @return [Integer]
# @see http://ruby-doc.org/core/classes/Comparable.html
subject <=> other.subject
This guarantees that there is at least always some reasonable default ordering available (namely, that of the resource identifiers the instances represent), which users can override in their own Spira model class implementations should they ever need to.
Just waking up and haven't thought this through, but is this appropriate when considering that subjects can be Nodes? What are you doing, exactly?
Anything that mixes in RDF::Value is comparable, so it doesn't matter whether subjects are URIs or blank nodes.
Not sure if you closed this by accident or on purpose, but I still think this one-line method ought to be a part of Spira directly out of the shrinkwrap ;-)
I did indeed close it accidentally and thusly forgot about it. I will go ahead and add this.
This project has moved to ruby-rdf/spira. If this issue is still relevant, please resubmit it over there.