Class: Relaton::Iec::Bibliography
- Inherits:
-
Object
- Object
- Relaton::Iec::Bibliography
- Extended by:
- Core::ArrayWrapper
- Defined in:
- lib/relaton/iec/bibliography.rb
Overview
Class methods for search IEC standards.
Constant Summary collapse
- DOCTYPES =
%w[TS TR PAS SRD TEC STTR WP Guide OD CS CA].freeze
Class Method Summary collapse
- .get(code, year = nil, opts = {}) ⇒ Relaton::Iec::ItemData?
-
.search(pubid, exclude: [:year]) ⇒ Relaton::Iec::HitCollection
Search for standards entries.
Class Method Details
.get(code, year = nil, opts = {}) ⇒ Relaton::Iec::ItemData?
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/relaton/iec/bibliography.rb', line 32 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] || opts[:publication_date_before] || opts[:publication_date_after] ret end |
.search(pubid, exclude: [:year]) ⇒ Relaton::Iec::HitCollection
Search for standards entries.
21 22 23 24 25 |
# File 'lib/relaton/iec/bibliography.rb', line 21 def search(pubid, exclude: [:year]) HitCollection.new(pubid).search(exclude: exclude) rescue SocketError, OpenSSL::SSL::SSLError => e raise Relaton::RequestError, e. end |