Class: OpenXml::Xlsx::Elements::Relationship

Inherits:
Struct
  • Object
show all
Defined in:
lib/openxml/xlsx/elements/relationship.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, target, id = nil) ⇒ Relationship

Returns a new instance of Relationship.



8
9
10
11
# File 'lib/openxml/xlsx/elements/relationship.rb', line 8

def initialize(type, target, id=nil)
  id ||= "R#{SecureRandom.hex}"
  super type, target, id
end

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



6
7
8
# File 'lib/openxml/xlsx/elements/relationship.rb', line 6

def id
  @id
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



6
7
8
# File 'lib/openxml/xlsx/elements/relationship.rb', line 6

def target
  @target
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



6
7
8
# File 'lib/openxml/xlsx/elements/relationship.rb', line 6

def type
  @type
end

Instance Method Details

#to_xml(xml) ⇒ Object



13
14
15
# File 'lib/openxml/xlsx/elements/relationship.rb', line 13

def to_xml(xml)
  xml.Relationship("Id" => id, "Type" => type, "Target" => target)
end