Class: Coradoc::Element::Inline::CrossReference
- Defined in:
- lib/coradoc/element/inline/cross_reference.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#href ⇒ Object
Returns the value of attribute href.
Instance Method Summary collapse
-
#initialize(href, args = nil) ⇒ CrossReference
constructor
A new instance of CrossReference.
- #to_adoc ⇒ Object
Methods inherited from Base
access_children, #children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(href, args = nil) ⇒ CrossReference
9 10 11 12 13 14 |
# File 'lib/coradoc/element/inline/cross_reference.rb', line 9 def initialize(href, args = nil) @href = href @args = args @args = nil if @args == "" @args = [@args] unless @args.is_a?(Array) || @args == nil end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
5 6 7 |
# File 'lib/coradoc/element/inline/cross_reference.rb', line 5 def args @args end |
#href ⇒ Object
Returns the value of attribute href.
5 6 7 |
# File 'lib/coradoc/element/inline/cross_reference.rb', line 5 def href @href end |
Instance Method Details
#to_adoc ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/coradoc/element/inline/cross_reference.rb', line 16 def to_adoc if @args args = @args.map do |a| Coradoc::Generator.gen_adoc(a) end.join(",") if args.empty? return "<<#{@href}>>" else return "<<#{@href},#{args}>>" end end "<<#{@href}>>" end |