Class: Coradoc::Element::Inline::Link
- Inherits:
-
Object
- Object
- Coradoc::Element::Inline::Link
- Defined in:
- lib/coradoc/element/inline/link.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Link
constructor
A new instance of Link.
- #to_adoc ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Link
Returns a new instance of Link.
7 8 9 10 11 |
# File 'lib/coradoc/element/inline/link.rb', line 7 def initialize( = {}) @path = .fetch(:path,nil) @title = .fetch(:title, nil) @name = .fetch(:name,nil) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/coradoc/element/inline/link.rb', line 5 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/coradoc/element/inline/link.rb', line 5 def path @path end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/coradoc/element/inline/link.rb', line 5 def title @title end |
Instance Method Details
#to_adoc ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/coradoc/element/inline/link.rb', line 13 def to_adoc link = @path.to_s =~ URI::DEFAULT_PARSER.make_regexp ? @path : "link:#{@path}" if @name.to_s.empty? link << "[#{@title}]" else link << "[#{@name}]" end link.prepend(' ') link end |