class Biblionet::Extractors::PublisherExtractor

Attributes

publisher[R]

Public Class Methods

new(uri=nil) click to toggle source
Calls superclass method Biblionet::Extractors::Base::new
# File lib/bookshark/extractors/publisher_extractor.rb, line 12
def initialize(uri=nil)
  super(uri)        
  extract_publisher unless uri.nil? or @page.nil?        
end

Public Instance Methods

extract_publisher(biblionet_id=@biblionet_id, publisher_page=@page) click to toggle source
# File lib/bookshark/extractors/publisher_extractor.rb, line 23
def extract_publisher(biblionet_id=@biblionet_id, publisher_page=@page)
  puts "Extracting publisher: #{biblionet_id}"
  page = PublisherDataExtractor.new(publisher_page)
  
  return nil if page.nodeset.nil?
          
  headquarters                    = page.headquarters
  bookstores                      = page.bookstores
  bookstores['Έδρα']              = headquarters unless headquarters.all? {|k,v| v.nil? or v.empty?}

  publisher_hash = {}
  publisher_hash[:name]          = page.name
  publisher_hash[:owner]         = page.owner       
  publisher_hash[:bookstores]    = bookstores
  publisher_hash[:b_id]          = biblionet_id

  return @publisher = publisher_hash
end
load_and_extract_publisher(uri=nil) click to toggle source
# File lib/bookshark/extractors/publisher_extractor.rb, line 18
def load_and_extract_publisher(uri=nil)
  load_page(uri)
  extract_publisher unless uri.nil? or @page.nil?
end