Class: CiteProc::CitationItem

Inherits:
Object
  • Object
show all
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

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Yields:

  • (_self)

Yield Parameters:



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

.labelsObject (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_onlyBoolean

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.

Returns:

  • (Boolean)

    whether or not only the author name will be included in the citation output for this cite



# File 'lib/citeproc/citation_data.rb', line 39

#dataObject

Returns the value of attribute data.



59
60
61
# File 'lib/citeproc/citation_data.rb', line 59

def data
  @data
end

#idSymbol, String

Returns the id of the corresponding resource.

Returns:

  • (Symbol, String)

    the id of the corresponding resource



# File 'lib/citeproc/citation_data.rb', line 22

#labelSymbol, 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.

Returns:

  • (Symbol, String)

    the label type



# File 'lib/citeproc/citation_data.rb', line 29

#locatorString

Returns a string identifying a page number or similar to mark a location or range within the resource.

Returns:

  • (String)

    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

#prefixString

Returns a string to print before cites produced for this item.

Returns:

  • (String)

    a string to print before cites produced for this item



# File 'lib/citeproc/citation_data.rb', line 46

#suffixString

Returns a string to print after cites produced for this item.

Returns:

  • (String)

    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_authorBoolean

Returns whether or not author names will not be included in the citation output for this cite.

Returns:

  • (Boolean)

    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

#inspectString

Returns a human-readable representation of the citation item.

Returns:

  • (String)

    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