Class: Wings::Valkyrie::Storage::Version

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/wings/valkyrie/storage.rb

Overview

abstractly, Version objects should have an #id and be orderable over #<=> (allowing e.g. ‘#sort` to define a consistent order— oldest to newest—for a collection of versions). the #id should be a globally unique identifier for the version.

this implementation uses an orderable #version_token. in practice the token is the fcrepo created date for the version, as extracted from the versions graph.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter

Returns:

  • (Object)

    the current value of adapter



89
90
91
# File 'lib/wings/valkyrie/storage.rb', line 89

def adapter
  @adapter
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



89
90
91
# File 'lib/wings/valkyrie/storage.rb', line 89

def id
  @id
end

#version_tokenObject

Returns the value of attribute version_token

Returns:

  • (Object)

    the current value of version_token



89
90
91
# File 'lib/wings/valkyrie/storage.rb', line 89

def version_token
  @version_token
end

Instance Method Details

#<=>(other) ⇒ Object

Raises:

  • (ArgumentError)


98
99
100
101
# File 'lib/wings/valkyrie/storage.rb', line 98

def <=>(other)
  raise ArgumentError unless other.respond_to?(:version_token)
  version_token <=> other.version_token
end

#io#read

Returns:

  • (#read)


94
95
96
# File 'lib/wings/valkyrie/storage.rb', line 94

def io
  adapter.find_by(id: id)
end