Class: Coradoc::Element::Inline::CrossReference

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/element/inline/cross_reference.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href, name = nil) ⇒ CrossReference

Returns a new instance of CrossReference.



7
8
9
10
# File 'lib/coradoc/element/inline/cross_reference.rb', line 7

def initialize(href, name = nil)
  @href = href
  @name = name
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



5
6
7
# File 'lib/coradoc/element/inline/cross_reference.rb', line 5

def href
  @href
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/coradoc/element/inline/cross_reference.rb', line 5

def name
  @name
end

Instance Method Details

#to_adocObject



12
13
14
15
16
17
18
# File 'lib/coradoc/element/inline/cross_reference.rb', line 12

def to_adoc
  if @name.to_s.empty?
    "<<#{@href}>>"
  else
    "<<#{@href},#{@name}>>"
  end
end