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
10
11
# File 'lib/active_fedora/versions_graph.rb', line 3

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

#resourcesObject



23
24
25
# File 'lib/active_fedora/versions_graph.rb', line 23

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

#with_label(label) ⇒ Object



17
18
19
20
21
# File 'lib/active_fedora/versions_graph.rb', line 17

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