Class: Wings::Valkyrie::Storage::Version
- Inherits:
-
Struct
- Object
- Struct
- Wings::Valkyrie::Storage::Version
- 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
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#created ⇒ Object
Returns the value of attribute created.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter
92 93 94 |
# File 'lib/wings/valkyrie/storage.rb', line 92 def adapter @adapter end |
#created ⇒ Object
Returns the value of attribute created
92 93 94 |
# File 'lib/wings/valkyrie/storage.rb', line 92 def created @created end |
#id ⇒ Object
Returns the value of attribute id
92 93 94 |
# File 'lib/wings/valkyrie/storage.rb', line 92 def id @id end |
Instance Method Details
#<=>(other) ⇒ Object
105 106 107 108 |
# File 'lib/wings/valkyrie/storage.rb', line 105 def <=>(other) raise ArgumentError unless other.respond_to?(:version_token) version_token <=> other.version_token end |
#io ⇒ #read
97 98 99 |
# File 'lib/wings/valkyrie/storage.rb', line 97 def io adapter.find_by(id: id) end |
#version_token ⇒ Object
101 102 103 |
# File 'lib/wings/valkyrie/storage.rb', line 101 def version_token created end |