Class: Mexico::FileSystem::ItemLink
- Inherits:
-
Object
- Object
- Mexico::FileSystem::ItemLink
- Includes:
- Poseidon, ROXML
- Defined in:
- lib/mexico/file_system/item_link.rb
Overview
A link from an item to a layer.
Constant Summary collapse
- ROLE_PARENT =
'parent'
- ROLE_CHILD =
'child'
- ROLE_PREDECESSOR =
'predecessor'
- ROLE_SUCCESSOR =
'successor'
- INVERSE_ROLES =
{ ROLE_PARENT => ROLE_CHILD, ROLE_CHILD => ROLE_PARENT, ROLE_PREDECESSOR => ROLE_SUCCESSOR, ROLE_SUCCESSOR => ROLE_PREDECESSOR }
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#item ⇒ Object
Returns the value of attribute item.
Instance Method Summary collapse
-
#after_parse ⇒ Object
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.
-
#initialize(args = {}) ⇒ ItemLink
constructor
A new instance of ItemLink.
-
#target_object ⇒ Mexico::FileSystem::Item
(also: #target_item)
returns the target object, in this case, an Item.
-
#target_object=(new_target) ⇒ void
Sets a new target object (and updates the corresponding identifier).
Constructor Details
#initialize(args = {}) ⇒ ItemLink
Returns a new instance of ItemLink.
57 58 59 60 61 62 63 |
# File 'lib/mexico/file_system/item_link.rb', line 57 def initialize(args={}) args.each do |k,v| if self.respond_to?("#{k}=") send("#{k}=", v) end end end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
47 48 49 |
# File 'lib/mexico/file_system/item_link.rb', line 47 def document @document end |
#item ⇒ Object
Returns the value of attribute item.
46 47 48 |
# File 'lib/mexico/file_system/item_link.rb', line 46 def item @item end |
Instance Method Details
#after_parse ⇒ Object
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.
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/mexico/file_system/item_link.rb', line 83 def after_parse # puts "item link after parse. What is the situation?" # # if ::Mexico::FileSystem::FiestaDocument.knows?(target) # puts " store knows the needed target. fetch it and set it." # @target_object=::Mexico::FileSystem::FiestaDocument.resolve(target) # puts " %s" % @target_object # else # # store i in watch list # ::Mexico::FileSystem::FiestaDocument.watch(target, item, :target_object=) # end end |
#target_object ⇒ Mexico::FileSystem::Item Also known as: target_item
returns the target object, in this case, an Item.
67 68 69 |
# File 'lib/mexico/file_system/item_link.rb', line 67 def target_object @target_object end |
#target_object=(new_target) ⇒ void
This method returns an undefined value.
Sets a new target object (and updates the corresponding identifier)
74 75 76 77 78 |
# File 'lib/mexico/file_system/item_link.rb', line 74 def target_object=(new_target) # puts "SETTING target object to %s, %s" % [new_target.identifier, new_target] @target_object=new_target @target=target_object.identifier end |