Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for YAML serialization/de-serialization of Spira::Base inst #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gkellogg
Copy link

Added support for YAML serialization/de-serialization of Spira::Base instances using Psych.

I basically fixed the serialization I was doing in sparql-tests, and made it more generic. The only other change I found useful was to implement #encode_with and #init_with for RDF::URI, as otherwise Addressable is serialized. This is what I did there. Maybe it should be in Spira too.

# Save short version of URI, without all the Addressable stuff.
class RDF::URI
  def encode_with(coder)
    coder["uri"] = self.to_s
  end

  def init_with(coder)
    @uri = Addressable::URI.parse(coder["uri"])
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant