Class: LocMarc::Codes::CodeList
- Inherits:
-
Object
- Object
- LocMarc::Codes::CodeList
show all
- Defined in:
- lib/loc_marc/codes.rb
Constant Summary
collapse
- DATABASE =
{}
Class Method Summary
collapse
Class Method Details
.lookup(code) ⇒ Object
23
24
25
|
# File 'lib/loc_marc/codes.rb', line 23
def self.lookup(code)
DATABASE[code]
end
|
.parse_raw(raw_data) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/loc_marc/codes.rb', line 8
def self.parse_raw(raw_data)
raw_data.split("\n").each do |line|
next if line.empty?
code, desc = line.split("\t")
deprecated = (code[0] == '-')
code = code[1..-1] if deprecated
DATABASE[code] = {
code: code,
description: desc,
deprecated: deprecated
}
end
end
|