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)


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

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

#internal?Boolean

Returns:

  • (Boolean)


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

def internal?
  !anchor.nil?
end

#targetObject



30
31
32
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 30

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

#target=(value) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 34

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

#urlObject



42
43
44
# File 'lib/uniword/wordprocessingml/hyperlink.rb', line 42

def url
  id
end