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(text, year = nil) ⇒ RelatonIec::HitCollection
Class Method Details
.get(code, year = nil, opts = {}) ⇒ String
Returns Relaton XML serialisation of reference.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 30 def get(code, year = nil, opts = {}) if year.nil? /^(?<code1>[^:]+):(?<year1>[^:]+)$/ =~ code unless code1.nil? code = code1 year = year1 end end return iev if code.casecmp("IEV").zero? code += "-1" if opts[:all_parts] ret = iecbib_get1(code, year, opts) return nil if ret.nil? ret.to_most_recent_reference unless year || opts[:keep_year] ret.to_all_parts if opts[:all_parts] ret end |
.search(text, year = nil) ⇒ RelatonIec::HitCollection
14 15 16 17 18 |
# File 'lib/relaton_iec/iec_bibliography.rb', line 14 def search(text, year = nil) HitCollection.new text, year rescue SocketError, OpenURI::HTTPError raise RelatonBib::RequestError, "Could not access http://www.iec.ch" end |