Class: Relaton::Isbn::Parser
- Inherits:
-
Object
- Object
- Relaton::Isbn::Parser
- Defined in:
- lib/relaton/isbn/parser.rb
Overview
OpenLibrary document parser.
Constant Summary collapse
- ATTRS =
%i[fetched title docidentifier source contributor date place ext].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(doc) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(doc) ⇒ Parser
Returns a new instance of Parser.
9 10 11 |
# File 'lib/relaton/isbn/parser.rb', line 9 def initialize(doc) @doc = doc end |
Class Method Details
.parse(doc) ⇒ Object
13 14 15 |
# File 'lib/relaton/isbn/parser.rb', line 13 def self.parse(doc) new(doc).parse end |
Instance Method Details
#parse ⇒ Object
17 18 19 20 |
# File 'lib/relaton/isbn/parser.rb', line 17 def parse args = ATTRS.each_with_object({}) { |a, h| h[a] = send(a) } Bib::ItemData.new(**args) end |