Class: Gbbib::GbBibliography

Inherits:
Object
  • Object
show all
Defined in:
lib/gbbib/gb_bibliography.rb

Overview

GB entry point class.

Class Method Summary collapse

Class Method Details

.search(text) ⇒ Gbbib::Hits

rubocop:disable Metrics/MethodLength

Parameters:

  • text (Strin)

    code of standard for search

Returns:

  • (Gbbib::Hits)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gbbib/gb_bibliography.rb', line 11

def search(text)
  if text.match?(/^(GB|GJ|GS)/)
    # Scrape national standards.
    require 'gbbib/gb_scrapper'
    GbScrapper.scrape_page text
  elsif text.match?(/^ZB/)
    # Scrape proffesional.
  elsif text.match?(/^DB/)
    # Scrape local standard.
  elsif text.match? %r{^Q\/}
    # Enterprise standard
  elsif text.match? %r{^T\/[^\s]{3,6}\s}
    # Scrape social standard.
    require 'gbbib/t_scrapper'
    TScrapper.scrape_page text
  else
    # Scrape sector standard.
    require 'gbbib/sec_scrapper'
    SecScrapper.scrape_page text
  end
end