Class: Docxi::Word::Relationships::Relationship

Inherits:
Object
  • Object
show all
Defined in:
lib/docxi/word/relationships/relationship.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, type, target, tm = '') ⇒ Relationship

Returns a new instance of Relationship.



8
9
10
11
12
13
# File 'lib/docxi/word/relationships/relationship.rb', line 8

def initialize(id, type, target, tm = '')
  @id = id
  @type = type
  @target = target
  @tm = tm
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/docxi/word/relationships/relationship.rb', line 6

def id
  @id
end

#targetObject

Returns the value of attribute target.



6
7
8
# File 'lib/docxi/word/relationships/relationship.rb', line 6

def target
  @target
end

#tmObject

Returns the value of attribute tm.



6
7
8
# File 'lib/docxi/word/relationships/relationship.rb', line 6

def tm
  @tm
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/docxi/word/relationships/relationship.rb', line 6

def type
  @type
end

Instance Method Details

#build(xml) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/docxi/word/relationships/relationship.rb', line 15

def build(xml)
  if @tm.blank?
    xml.Relationship('Id' => @id, 'Type' => @type, 'Target' => @target)
  else
    xml.Relationship('Id' => @id, 'Type' => @type, 'Target' => @target, 'TargetMode' => @tm)
  end
end