Class: AsciidocBib::Citation
- Inherits:
-
Object
- Object
- AsciidocBib::Citation
- Defined in:
- lib/asciidoc-bib/citation.rb
Overview
Holds information about a single citation: its reference and any page numbers
Instance Attribute Summary collapse
-
#pages ⇒ Object
readonly
Page numbers.
-
#ref ⇒ Object
readonly
Reference for a citation.
Instance Method Summary collapse
-
#initialize(ref, pages) ⇒ Citation
constructor
Construct instance of citation, from a reference and definition of page numbers.
- #to_s ⇒ Object
Constructor Details
#initialize(ref, pages) ⇒ Citation
Construct instance of citation, from a reference and definition of page numbers.
12 13 14 15 16 17 18 |
# File 'lib/asciidoc-bib/citation.rb', line 12 def initialize ref, pages @ref = ref @pages = pages # clean up pages @pages = '' unless @pages @pages.gsub!("--","-") end |
Instance Attribute Details
#pages ⇒ Object (readonly)
Page numbers
9 10 11 |
# File 'lib/asciidoc-bib/citation.rb', line 9 def pages @pages end |
#ref ⇒ Object (readonly)
Reference for a citation
7 8 9 |
# File 'lib/asciidoc-bib/citation.rb', line 7 def ref @ref end |
Instance Method Details
#to_s ⇒ Object
20 21 22 |
# File 'lib/asciidoc-bib/citation.rb', line 20 def to_s "#{@ref}:#{@pages}" end |