Class: ActiveFedora::VersionsGraph

Inherits:
RDF::Graph
  • Object
show all
Defined in:
lib/active_fedora/versions_graph.rb

Defined Under Namespace

Classes: ResourceVersion

Instance Method Summary collapse

Instance Method Details

#all(opts = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/active_fedora/versions_graph.rb', line 3

def all(opts = {})
  versions = fedora_versions
  versions.reject! { |version| version.label =~ /auto/ } unless opts[:include_auto_save]
  versions.sort_by { |version| DateTime.parse(version.created) }
rescue ArgumentError, NoMethodError
  raise ActiveFedora::VersionLacksCreateDate
end

#resourcesObject



21
22
23
# File 'lib/active_fedora/versions_graph.rb', line 21

def resources
  query({ predicate: ::RDF::Vocab::Fcrepo4.hasVersion })
end

#with_label(label) ⇒ Object



15
16
17
18
19
# File 'lib/active_fedora/versions_graph.rb', line 15

def with_label(label)
  all.each do |version|
    return version if version.label == label
  end
end