Private callback methods and refactoring #40

wants to merge 3 commits into


None yet
3 participants

Greetings! (and sorry for the numerous edits of this pull request - there were some "technical" problems).
Here's a small update from a fan of spira. I believe that the hook (callback) methods generally should be made private (and thus provide for a good API design), but your current implementation calls them only if they are public. I've fixed that and wrote a spec to detect that "bug".

Also added a couple of refactoring commits - while generally making the code more readable (IMHO) and DRY, they were initially aimed at fixing a bug, which was surfaced by abrisse's introduction of Spira::Types::Data property type. Since I cannot submit a spec for it without merging abrisse's pull request, here's a way to detect it until the merge occurs:

class Person
include Spira::Resource
base_uri ""
property :birthday, :predicate => FOAF.birthday, :type => Date
bob ="bob")

The exception is raised at this point, because :birthday property is nil, but Spira::Resource#repository_for_attributes attempts to instantiate it, ultimately calling

abrisse commented Sep 21, 2011

+1 for this pull. I have done similar modification to repository_for_attributes to avoid the raise you point out but only on my local dev branch.

Hope this pull will be included soon in the official spira branch.


bendiken commented Aug 27, 2014

This project has moved to ruby-rdf/spira. If this pull request is still relevant, please rebase and resubmit it over there.

bendiken closed this Aug 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment