Class: RubyPoint::Relationship

Inherits:
Element
  • Object
show all
Defined in:
lib/rubypoint/relationship.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#objects, #parent, #presentation

Instance Method Summary collapse

Methods inherited from Element

class_attributes

Constructor Details

#initialize(parent, object = false) ⇒ Relationship

Returns a new instance of Relationship.



6
7
8
9
10
11
12
13
# File 'lib/rubypoint/relationship.rb', line 6

def initialize(parent, object=false)
  @parent = parent
  @rel_id = parent.next_rel_id
  if object
    @object = object
    @object.rel_id = @rel_id
  end
end

Instance Attribute Details

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/rubypoint/relationship.rb', line 3

def object
  @object
end

#rel_idObject

Returns the value of attribute rel_id.



3
4
5
# File 'lib/rubypoint/relationship.rb', line 3

def rel_id
  @rel_id
end

Instance Method Details

#rawObject



19
20
21
22
23
# File 'lib/rubypoint/relationship.rb', line 19

def raw
raw = <<EOF 
<Relationship Id="rId#{self.rel_id}" Type="#{self.type}" Target="#{self.target}"/>
EOF
end

#writeObject



15
16
17
# File 'lib/rubypoint/relationship.rb', line 15

def write
  @parent.doc.search('//Relationships').append(self.raw)
end