Class: RelatonIsbn::Parser
- Inherits:
-
Object
- Object
- RelatonIsbn::Parser
- Defined in:
- lib/relaton_isbn/parser.rb
Overview
OpenLibrary document parser.
Constant Summary collapse
- ATTRS =
i[fetched title docid link contributor date place].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.
8 9 10 |
# File 'lib/relaton_isbn/parser.rb', line 8 def initialize(doc) @doc = doc end |
Class Method Details
.parse(doc) ⇒ Object
12 13 14 |
# File 'lib/relaton_isbn/parser.rb', line 12 def self.parse(doc) new(doc).parse end |
Instance Method Details
#parse ⇒ Object
16 17 18 19 |
# File 'lib/relaton_isbn/parser.rb', line 16 def parse args = ATTRS.each_with_object({}) { |a, h| h[a] = send(a) } RelatonBib::BibliographicItem.new(**args) end |