Class: Uniword::Wordprocessingml::Hyperlink

Inherits:
Lutaml::Model::Serializable
  • Object
show all
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)


53
54
55
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 53

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

#internal?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 49

def internal?
  !anchor.nil?
end

#targetObject



33
34
35
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 33

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

#target=(value) ⇒ Object



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

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

#urlObject



45
46
47
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 45

def url
  id
end