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


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

def all opts={}
  if opts[:include_auto_save]
    fedora_versions
  else
    fedora_versions.reject { |v| v.label.match("auto") }
  end
end

#firstObject


12
13
14
# File 'lib/active_fedora/versions_graph.rb', line 12

def first
  all.first
end

#lastObject


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

def last
  all.last
end

#resourcesObject


26
27
28
# File 'lib/active_fedora/versions_graph.rb', line 26

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

#with_label(label) ⇒ Object


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

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