module ActiveFedora::Common

def <=>(other)

Allows sort on objects
def <=>(other)
  if other.is_a?(self.class)
    to_key <=> other.to_key
  else
    super
  end
end

def ==(other)

models are still comparable.
Note also that destroying a record preserves its ID in the model instance, so deleted

other record is the receiver itself.
Note that new records are different from any other record by definition, unless the

is of the same type and +self+ has an ID and it is equal to +comparison_object.id+.
Returns true if +comparison_object+ is the same exact object, or +comparison_object+
def ==(other)
  other.equal?(self) ||
    (other.instance_of?(self.class) &&
      !id.nil? &&
      other.id == id)
end

def freeze

Freeze datastreams such that they can be loaded from Fedora, but can't be changed
def freeze
  @frozen = true
end

def frozen?

def frozen?
  @frozen.present?
end

def ldp_source

def ldp_source
  @ldp_source
end

def readonly!

Marks this record as read only.
def readonly!
  @readonly = true
end

def readonly?

attributes will be marked as read only since they cannot be saved.
Returns +true+ if the record is read only. Records loaded through joins with piggy-back
def readonly?
  @readonly
end