Class: CiteProc::CitationItem
- Inherits:
-
Object
- Object
- CiteProc::CitationItem
- Extended by:
- Forwardable
- Includes:
- Attributes, Comparable
- Defined in:
- lib/citeproc/citation_data.rb
Overview
A CitationItem consititues the main input elements to CiteProc’s processing methods. In order to be processed correctly, an item must have a valid #id attribute used to retrieve the correpsonding Item containing the actual bibliographic data.
Class Attribute Summary collapse
-
.labels ⇒ Object
readonly
Returns the value of attribute labels.
Instance Attribute Summary collapse
-
#author_only ⇒ Boolean
This optional parameter provides a means for certain demanding styles that require the processor output to be divided between the main text and a footnote.
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Symbol, String
The id of the corresponding resource.
-
#label ⇒ Symbol, String
Labels indicate whether the current locator is to a page, a chapter, or other subdivision of the target resource.
-
#locator ⇒ String
A string identifying a page number or similar to mark a location or range within the resource.
-
#prefix ⇒ String
A string to print before cites produced for this item.
-
#suffix ⇒ String
A string to print after cites produced for this item.
-
#suppress_author ⇒ Boolean
Whether or not author names will not be included in the citation output for this cite.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(attributes = nil) {|_self| ... } ⇒ CitationItem
constructor
A new instance of CitationItem.
- #initialize_copy(other) ⇒ Object
-
#inspect ⇒ String
A human-readable representation of the citation item.
Methods included from Attributes
#attribute?, #eql?, #hash, #merge, #read_attribute, #reverse_merge, #to_citeproc, #to_hash, #to_json, #write_attribute
Constructor Details
#initialize(attributes = nil) {|_self| ... } ⇒ CitationItem
Returns a new instance of CitationItem.
64 65 66 67 |
# File 'lib/citeproc/citation_data.rb', line 64 def initialize(attributes = nil) merge(attributes) yield self if block_given? end |
Class Attribute Details
.labels ⇒ Object (readonly)
Returns the value of attribute labels.
19 20 21 |
# File 'lib/citeproc/citation_data.rb', line 19 def labels @labels end |
Instance Attribute Details
#author_only ⇒ Boolean
This optional parameter provides a means for certain demanding styles that require the processor output to be divided between the main text and a footnote.
|
# File 'lib/citeproc/citation_data.rb', line 39
|
#data ⇒ Object
Returns the value of attribute data.
59 60 61 |
# File 'lib/citeproc/citation_data.rb', line 59 def data @data end |
#id ⇒ Symbol, String
Returns the id of the corresponding resource.
|
# File 'lib/citeproc/citation_data.rb', line 22
|
#label ⇒ Symbol, String
Labels indicate whether the current locator is to a page, a chapter, or other subdivision of the target resource. Valid labels are defined by labels.
|
# File 'lib/citeproc/citation_data.rb', line 29
|
#locator ⇒ String
Returns a string identifying a page number or similar to mark a location or range within the resource.
|
# File 'lib/citeproc/citation_data.rb', line 25
|
#prefix ⇒ String
Returns a string to print before cites produced for this item.
|
# File 'lib/citeproc/citation_data.rb', line 46
|
#suffix ⇒ String
Returns a string to print after cites produced for this item.
52 53 |
# File 'lib/citeproc/citation_data.rb', line 52 attr_predicates :id, :locator, :page, :label, :'suppress-author', :'author-only', :prefix, :suffix |
#suppress_author ⇒ Boolean
Returns whether or not author names will not be included in the citation output for this cite.
|
# File 'lib/citeproc/citation_data.rb', line 35
|
Instance Method Details
#<=>(other) ⇒ Object
73 74 75 76 |
# File 'lib/citeproc/citation_data.rb', line 73 def <=>(other) return unless other.respond_to?(:data) data <=> other.data end |
#initialize_copy(other) ⇒ Object
69 70 71 |
# File 'lib/citeproc/citation_data.rb', line 69 def initialize_copy(other) @attributes = other.attributes.deep_copy end |
#inspect ⇒ String
Returns a human-readable representation of the citation item.
79 80 81 |
# File 'lib/citeproc/citation_data.rb', line 79 def inspect "#<CiteProc::CitationItem #{[id, locator].compact.map(&:inspect).join(', ')}>" end |