Module: Relaton::Itu::Bibliography

Extended by:
Bibliography
Included in:
Bibliography
Defined in:
lib/relaton/itu/bibliography.rb

Instance Method Summary collapse

Instance Method Details

#get(code, year = nil, opts = {}) ⇒ Relaton::Bib::ItemData?

Parameters:

  • code (String)

    the ITU standard Code to look up

  • year (String) (defaults to: nil)

    the year the standard was published (optional)

  • opts (Hash) (defaults to: {})

    options

Returns:

  • (Relaton::Bib::ItemData, nil)


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/relaton/itu/bibliography.rb', line 22

def get(code, year = nil, opts = {})
  warn_incorrect_ref(code)
  refid = Pubid.parse code
  refid.year ||= year

  ret = itubib_get1(refid)
  return nil if ret.nil?

  ret = ret.to_most_recent_reference unless refid.year || opts[:keep_year]
  ret = ret.to_all_parts if opts[:all_parts]
  ret
end

#search(refid) ⇒ Relaton::Itu::HitCollection

Parameters:

Returns:



10
11
12
13
14
15
16
# File 'lib/relaton/itu/bibliography.rb', line 10

def search(refid)
  if refid.is_a? String
    warn_incorrect_ref(refid)
    refid = Pubid.parse refid
  end
  HitCollection.new(refid).tap(&:search)
end