class Resync::Augmented

Base class for elements augmented with ResourceSync-specific child elements.

@!attribute [rw] links

@return [Array<Link>] related links.

@!attribute [rw] metadata

@return [Metadata] metadata about this object.

Constants

RS_TAGS

ResourceSync-specific tags needing to be prefixed with rs on output

Public Class Methods

new(links: [], metadata: nil) click to toggle source

Creates a new Augmented instance with the specified links and metadata.

@param links [Array<Link>] related links (i.e. +<rs:ln>+). @param metadata [Metadata] metadata about this resource.

# File lib/resync/shared/augmented.rb, line 48
def initialize(links: [], metadata: nil)
  self.links = links
  self.metadata = metadata
end

Private Class Methods

prefix_rewriter(obj, xml, default_obj_to_xml) click to toggle source

Adds the rs namespace prefix

# File lib/resync/shared/augmented.rb, line 23
def self.prefix_rewriter(obj, xml, default_obj_to_xml)
  default_obj_to_xml.call(obj, xml)
  xml.each_element do |e|
    e.name = "rs:#{e.name}" if RS_TAGS.include?(e.name)
  end
end

Public Instance Methods

at_time() click to toggle source

Convenience accessor for the at_time metadata attribute @return [Time] the datetime at which assembling a resource list

began (including resource list indices, resource dumps, etc.)

@see Metadata#at_time

# File lib/resync/shared/augmented.rb, line 80
def at_time
  metadata.at_time if metadata
end
change() click to toggle source

Convenience accessor for the change metadata attribute @return [Change] the type of change to a resource reported in

a change list (including change list indices, change dumps, etc.)

@see Metadata#change

# File lib/resync/shared/augmented.rb, line 112
def change
  metadata.change if metadata
end
completed_time() click to toggle source

Convenience accessor for the completed_time metadata attribute @return [Time] the datetime at which assembling a resource list

ended (including resource list indices, resource dumps, etc.)

@see Metadata#completed_time

# File lib/resync/shared/augmented.rb, line 104
def completed_time
  metadata.completed_time if metadata
end
from_time() click to toggle source

Convenience accessor for the from_time metadata attribute @return [Time] the beginning of the time range represented by

a change list (including change list indices, change dumps, etc.)

@see Metadata#from_time

# File lib/resync/shared/augmented.rb, line 88
def from_time
  metadata.from_time if metadata
end
until_time() click to toggle source

Convenience accessor for the until_time metadata attribute @return [Time] the end of the time range represented by

a change list (including change list indices, change dumps, etc.)

@see Metadata#until_time

# File lib/resync/shared/augmented.rb, line 96
def until_time
  metadata.until_time if metadata
end