class Arx::Author

Entity/model representing an arXiv paper's author.

Constants

ATTRIBUTES

The attributes of an arXiv paper's author.

Public Instance Methods

==(author) click to toggle source

Equality check against another author.

@note This only performs a basic equality check between the authors' names. @param author [Author] The author to compare against. @return [Boolean]

# File lib/arx/entities/author.rb, line 58
def ==(author)
  if author.is_a? Author
    name == author.name
  else
    false
  end
end
affiliated?() click to toggle source

Whether or not the author has any affiliations.

@return [Boolean]

# File lib/arx/entities/author.rb, line 28
def affiliated?
  !affiliations.empty?
end
as_json() click to toggle source

Serializes the {Author} object into a valid JSON hash.

@return [Hash] The resulting JSON hash.

# File lib/arx/entities/author.rb, line 42
def as_json
  JSON.parse to_json
end
to_h() click to toggle source

Serializes the {Author} object into a Hash.

@return [Hash]

# File lib/arx/entities/author.rb, line 35
def to_h
  Hash[*ATTRIBUTES.map {|_| [_, send(_)]}.flatten(1)]
end
to_json() click to toggle source

Serializes the {Author} object into a valid JSON string.

@return [String] The resulting JSON string.

# File lib/arx/entities/author.rb, line 49
def to_json
  to_h.to_json
end
to_s() click to toggle source

A string representation of the {Author} object.

@return [String]

# File lib/arx/entities/author.rb, line 69
def to_s
  "Arx::Author(name: #{name}, affiliations: [#{affiliations.join(', ')}])"
end