Class: RelatonIec::IecBibliography
- Inherits:
-
Object
- Object
- RelatonIec::IecBibliography
- Defined in:
- lib/relaton_iec/iec_bibliography.rb
Overview
Class methods for search ISO standards.
Class Method Summary collapse
-
.get(code, year = nil, opts = {}) ⇒ String
Relaton XML serialisation of reference.
-
.search(ref, year = nil) ⇒ RelatonIec::HitCollection
Search for standards entries.
Class Method Details
.get(code, year = nil, opts = {}) ⇒ String
Returns Relaton XML serialisation of reference.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 29 def get(code, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity opts[:all_parts] ||= code.match?(/\s\(all parts\)/) ref = code.sub(/\s\(all parts\)/, "") year ||= ref_parts(ref)[:year] return iev if ref.casecmp("IEV").zero? ret = iecbib_get(ref, year, opts) return nil if ret.nil? ret = ret.to_most_recent_reference unless year || opts[:keep_year] ret end |
.search(ref, year = nil) ⇒ RelatonIec::HitCollection
Search for standards entries.
17 18 19 20 21 22 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 17 def search(ref, year = nil) # HitCollection.new text&.sub(/(^\w+)\//, '\1 '), year&.strip HitCollection.new ref, year&.strip rescue SocketError, OpenURI::HTTPError, OpenSSL::SSL::SSLError => e raise RelatonBib::RequestError, e. end |