class CFF::Entity
An Entity
can represent different types of entities, e.g., a publishing company, or conference. Like a Person
, an Entity
might have a number of roles, such as author, contact, editor, etc.
Entity
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):
-
`address`
-
`city`
-
`country`
-
`email`
-
`date_end` - Note: returns a `Date` object
-
`date_start` - Note: returns a `Date` object
-
`fax`
-
`location`
-
`name`
-
`orcid`
-
`post_code`
-
`region`
-
`tel`
-
`website`
Public Class Methods
Create a new Entity
with the supplied name.
# File lib/cff/entity.rb, line 56 def initialize(param) if param.is_a?(Hash) @fields = param @fields.default = '' else @fields = Hash.new('') @fields['name'] = param end yield self if block_given? end
Public Instance Methods
Set the `date-end` field. If a non-Date object is passed in it will be parsed into a Date.
# File lib/cff/entity.rb, line 73 def date_end=(date) date = Date.parse(date) unless date.is_a?(Date) @fields['date-end'] = date end
Set the `date-start` field. If a non-Date object is passed in it will be parsed into a Date.
# File lib/cff/entity.rb, line 84 def date_start=(date) date = Date.parse(date) unless date.is_a?(Date) @fields['date-start'] = date end