class Arx::Category

Entity/model representing an arXiv paper's category.

Constants

ATTRIBUTES

The attributes of an arXiv paper's category.

Public Instance Methods

==(category) click to toggle source

Equality check against another category.

@param category [Category] The category to compare against. @return [Boolean]

# File lib/arx/entities/category.rb, line 52
def ==(category)
  if category.is_a? Category
    name == category.name
  else
    false
  end
end
as_json() click to toggle source

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

@return [Hash] The resulting JSON hash.

# File lib/arx/entities/category.rb, line 37
def as_json
  JSON.parse to_json
end
full_name() click to toggle source

The full name of the category.

@see CATEGORIES @return [String]

# File lib/arx/entities/category.rb, line 23
def full_name
  CATEGORIES[name]
end
to_h() click to toggle source

Serializes the {Category} object into a Hash.

@return [Hash]

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

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

@return [String] The resulting JSON string.

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

A string representation of the {Category} object.

@return [String]

# File lib/arx/entities/category.rb, line 63
def to_s
  "Arx::Category(name: #{name}, full_name: #{full_name || 'nil'})"
end