Class: Arxiv::Downloader::Categories
- Inherits:
-
Object
- Object
- Arxiv::Downloader::Categories
- Defined in:
- lib/arxiv/downloader/categories.rb
Constant Summary collapse
- DATA_PATH =
File.('categories.yaml', __dir__).freeze
Instance Method Summary collapse
-
#initialize ⇒ Categories
constructor
A new instance of Categories.
- #lookup(id) ⇒ Object
Constructor Details
#initialize ⇒ Categories
Returns a new instance of Categories.
8 9 10 |
# File 'lib/arxiv/downloader/categories.rb', line 8 def initialize @data = YAML.load_file(DATA_PATH) end |
Instance Method Details
#lookup(id) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/arxiv/downloader/categories.rb', line 12 def lookup id entry = @data[id] return nil if entry.nil? { id: id, name: entry['name'], group: entry['group'], description: entry['description'] } end |