Sha256: 9d5023e262e71118128ce7a618154d3b8da6a8c481b50961c59a8b9ac9b9aa2d

Contents?: true

Size: 909 Bytes

Versions: 6

Compression:

Stored size: 909 Bytes

Contents

module Arxiv
  class Author
    include HappyMapper
    element :name, StringScrubber, parser: :scrub
    has_many :affiliations, StringScrubber, parser: :scrub, tag: 'affiliation'

    # Unfortunately, the ArXiv API does not provide separate attributes for
    # `author.first_name` and `author.last_name`; it only provides a single
    # `author.name` attribute.
    #
    # Yet most standards within academic publishing (e.g. JATS XML) prefer to
    # differentiate first name and last name of authors. To support that
    # expectation, we've split the name value (leveraging a third-party gem).
    # Ideally, ArXiv would provide this data directly. But until then, this
    # solution should be suitable.
    #
    def first_name
      FullNameSplitter.split(name).first
    end

    # See code comment for `first_name`.
    #
    def last_name
      FullNameSplitter.split(name).last
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arxiv-0.1.11 lib/arxiv/models/author.rb
arxiv-0.1.10 lib/arxiv/models/author.rb
arxiv-0.1.9 lib/arxiv/models/author.rb
arxiv-0.1.8 lib/arxiv/models/author.rb
arxiv-0.1.7 lib/arxiv/models/author.rb
arxiv-0.1.6 lib/arxiv/models/author.rb