Class: Uniword::Wordprocessingml::Hyperlink

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Includes:
HasRunPosition
Defined in:
lib/uniword/wordprocessingml/hyperlink.rb

Overview

Hyperlink element

Generated from OOXML schema: wordprocessingml.yml Element: <w:hyperlink>

Instance Method Summary collapse

Instance Method Details

#external?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 55

def external?
  !id.nil? && anchor.nil?
end

#internal?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 51

def internal?
  !anchor.nil?
end

#targetObject



35
36
37
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 35

def target
  anchor ? "##{anchor}" : id
end

#target=(value) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 39

def target=(value)
  if value.to_s.start_with?("#")
    self.anchor = value.sub(/^#/, "")
  else
    self.id = value
  end
end

#urlObject



47
48
49
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 47

def url
  id
end