class Mexico::FileSystem::Item

The basic data unit object.

Attributes

document[RW]

Public Class Methods

new(args={}) click to toggle source
# File lib/mexico/file_system/item.rb, line 65
def initialize(args={})
  args.each do |k,v|
    if self.respond_to?("#{k}=")
      send("#{k}=", v)
    end
  end
  @explicit_item_links = []
  @implicit_item_links = []
  @inverse_linked_items = []
  @layer_links = []
  @point_links = []
  @interval_links = []
end

Public Instance Methods

add_inverse_linked_item(item) click to toggle source
# File lib/mexico/file_system/item.rb, line 104
def add_inverse_linked_item(item)
  @inverse_linked_items << item
end
after_parse() click to toggle source

This method attempts to link objects from other locations of the XML/object tree into position inside this object, by following the xml ids given in the appropriate fields of this class.

# File lib/mexico/file_system/item.rb, line 82
def after_parse
  # store self
  ::Mexico::FileSystem::FiestaDocument.store(self.identifier, self)

  [item_links,layer_links,point_links,interval_links].flatten.each do |link|
    link.item = self

    if ::Mexico::FileSystem::FiestaDocument.knows?(link.target)
      link.target_object=::Mexico::FileSystem::FiestaDocument.resolve(link.target)
    else
      # store i in watch list
      ::Mexico::FileSystem::FiestaDocument.watch(link.target, link, :target_object=)
    end

  end

end
identifier=(new_id) click to toggle source
# File lib/mexico/file_system/item.rb, line 27
def identifier=(new_id)
  @identifier = Mexico::Util::to_xml_id(new_id)
end
layers() click to toggle source
# File lib/mexico/file_system/item.rb, line 152
def layers
  #puts layer_links.collect{|l| l.target}.join
  #puts layer_links.collect{|l| l.target.class }.join
  layer_links.collect{|l| l.layer }
end
sources() click to toggle source

Retrieves all items that act as a source (or predecessor) in the item link graph.

# File lib/mexico/file_system/item.rb, line 160
def sources
  @inverse_linked_items
end
targets() click to toggle source

Retrieves all items that act as a target (or successor) in the item link graph.

# File lib/mexico/file_system/item.rb, line 166
def targets
  item_links.collect{|l| l.target_object }
end