Class: RelatonIec::IecBibliography
- Inherits:
-
Object
- Object
- RelatonIec::IecBibliography
- Defined in:
- lib/relaton_iec/iec_bibliography.rb
Overview
Class methods for search IEC standards.
Class Method Summary collapse
- .get(code, year = nil, opts = {}) ⇒ RelatonIec::IecBibliographicItem?
-
.search(pubid, exclude: [:year]) ⇒ RelatonIec::HitCollection
Search for standards entries.
Class Method Details
.get(code, year = nil, opts = {}) ⇒ RelatonIec::IecBibliographicItem?
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 27 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\)/, "") return iev if ref.casecmp("IEV").zero? pubid = Pubid::Iec::Identifier.parse ref.upcase pubid.year = year.to_i if year ret = iecbib_get(pubid, opts) return nil if ret.nil? ret = ret.to_most_recent_reference unless pubid.year || opts[:keep_year] ret end |
.search(pubid, exclude: [:year]) ⇒ RelatonIec::HitCollection
Search for standards entries.
16 17 18 19 20 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 16 def search(pubid, exclude: [:year]) HitCollection.new pubid, exclude: exclude rescue SocketError, OpenSSL::SSL::SSLError => e raise RelatonBib::RequestError, e. end |