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.
- #identifier=(new_id) ⇒ Object
-
#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.
61 62 63 64 65 66 67 |
# File 'lib/mexico/file_system/item_link.rb', line 61 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.
51 52 53 |
# File 'lib/mexico/file_system/item_link.rb', line 51 def document @document end |
#item ⇒ Object
Returns the value of attribute item.
50 51 52 |
# File 'lib/mexico/file_system/item_link.rb', line 50 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.
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/mexico/file_system/item_link.rb', line 87 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 |
#identifier=(new_id) ⇒ Object
40 41 42 |
# File 'lib/mexico/file_system/item_link.rb', line 40 def identifier=(new_id) @identifier = Mexico::Util::to_xml_id(new_id) end |
#target_object ⇒ Mexico::FileSystem::Item Also known as: target_item
returns the target object, in this case, an Item.
71 72 73 |
# File 'lib/mexico/file_system/item_link.rb', line 71 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)
78 79 80 81 82 |
# File 'lib/mexico/file_system/item_link.rb', line 78 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 |