class CFF::Person

A Person represents a person in a CITATION.cff file. A Person might have a number of roles, such as author, contact, editor, etc.

Person implements all of the fields listed in the [CFF standard](citation-file-format.github.io/). All fields are simple strings and can be set as such. A field which has not been set will return the empty string. The simple fields are (with defaults in parentheses):

Public Class Methods

new → Person click to toggle source
new { |person| block } → Person
new(given_name, family_name) → Person
new(given_name, family_name) { |person| block } → Person

Create a new Person with the optionally supplied given and family names.

# File lib/cff/person.rb, line 60
def initialize(param = nil, *more)
  if param.is_a?(Hash)
    @fields = param
    @fields.default = ''
  else
    @fields = Hash.new('')

    unless param.nil?
      @fields['family-names'] = more[0]
      @fields['given-names'] = param
    end
  end

  yield self if block_given?
end