class ActiveFedora::ChangeSet

a Hash of properties that have changed and their present values

def changes

def changes
  @changes ||= changed_attributes.each_with_object({}) do |key, result|
    if object.respond_to?(:association) && object.association(key.to_sym).present?
      predicate = object.association(key.to_sym).reflection.predicate
      result[predicate] = graph.query(predicate: predicate)
    elsif object.class.properties.keys.include?(key)
      predicate = graph.reflections.reflect_on_property(key).predicate
      result[predicate] = graph.query(predicate: predicate)
    elsif object.local_attributes.include?(key)
      raise "Unable to find a graph predicate corresponding to the attribute: \"#{key}\""
    end
  end
end

def empty?

def empty?
  changes.empty?
end

def initialize(object, graph, changed_attributes)

Parameters:
  • changed_attributes (Array) -- A list of properties that have changed
  • graph (RDF::Graph) -- The RDF graph that holds the current state
  • object (ActiveFedora::Base) -- The resource that has associations and properties
def initialize(object, graph, changed_attributes)
  @object = object
  @graph = graph
  @changed_attributes = changed_attributes
end