Class: Arxivarius::Category

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/arxivarius/category.rb

Constant Summary collapse

CATEGORIES_PATH =

Maps category names to human-readable labels. Not available through the arXiv API, so we maintain a local copy.

File.expand_path('data/categories.yml', __dir__)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.typesObject



11
12
13
# File 'lib/arxivarius/category.rb', line 11

def self.types
  @types ||= YAML.safe_load_file(CATEGORIES_PATH)
end

Instance Method Details

#descriptionObject



17
18
19
# File 'lib/arxivarius/category.rb', line 17

def description
  Category.types[name]
end

#long_descriptionObject



21
22
23
# File 'lib/arxivarius/category.rb', line 21

def long_description
  description ? "#{name} (#{description})" : name
end