Class: Sovren::Publication
- Inherits:
-
Object
- Object
- Sovren::Publication
- Defined in:
- lib/sovren/publication.rb
Instance Attribute Summary collapse
-
#abstract ⇒ Object
Returns the value of attribute abstract.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#conference_date ⇒ Object
Returns the value of attribute conference_date.
-
#conference_location ⇒ Object
Returns the value of attribute conference_location.
-
#copyright_date ⇒ Object
Returns the value of attribute copyright_date.
-
#copyright_text ⇒ Object
Returns the value of attribute copyright_text.
-
#edition ⇒ Object
Returns the value of attribute edition.
-
#event_name ⇒ Object
Returns the value of attribute event_name.
-
#isbn ⇒ Object
Returns the value of attribute isbn.
-
#issue ⇒ Object
Returns the value of attribute issue.
-
#journal_or_serial_name ⇒ Object
Returns the value of attribute journal_or_serial_name.
-
#number_of_pages ⇒ Object
Returns the value of attribute number_of_pages.
-
#page_number ⇒ Object
Returns the value of attribute page_number.
-
#publication_date ⇒ Object
Returns the value of attribute publication_date.
-
#publisher_location ⇒ Object
Returns the value of attribute publisher_location.
-
#publisher_name ⇒ Object
Returns the value of attribute publisher_name.
-
#role ⇒ Object
Returns the value of attribute role.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#volume ⇒ Object
Returns the value of attribute volume.
Class Method Summary collapse
Instance Attribute Details
#abstract ⇒ Object
Returns the value of attribute abstract.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def abstract @abstract end |
#comments ⇒ Object
Returns the value of attribute comments.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def comments @comments end |
#conference_date ⇒ Object
Returns the value of attribute conference_date.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def conference_date @conference_date end |
#conference_location ⇒ Object
Returns the value of attribute conference_location.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def conference_location @conference_location end |
#copyright_date ⇒ Object
Returns the value of attribute copyright_date.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def copyright_date @copyright_date end |
#copyright_text ⇒ Object
Returns the value of attribute copyright_text.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def copyright_text @copyright_text end |
#edition ⇒ Object
Returns the value of attribute edition.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def edition @edition end |
#event_name ⇒ Object
Returns the value of attribute event_name.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def event_name @event_name end |
#isbn ⇒ Object
Returns the value of attribute isbn.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def isbn @isbn end |
#issue ⇒ Object
Returns the value of attribute issue.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def issue @issue end |
#journal_or_serial_name ⇒ Object
Returns the value of attribute journal_or_serial_name.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def journal_or_serial_name @journal_or_serial_name end |
#number_of_pages ⇒ Object
Returns the value of attribute number_of_pages.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def number_of_pages @number_of_pages end |
#page_number ⇒ Object
Returns the value of attribute page_number.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def page_number @page_number end |
#publication_date ⇒ Object
Returns the value of attribute publication_date.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def publication_date @publication_date end |
#publisher_location ⇒ Object
Returns the value of attribute publisher_location.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def publisher_location @publisher_location end |
#publisher_name ⇒ Object
Returns the value of attribute publisher_name.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def publisher_name @publisher_name end |
#role ⇒ Object
Returns the value of attribute role.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def role @role end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def type @type end |
#volume ⇒ Object
Returns the value of attribute volume.
3 4 5 |
# File 'lib/sovren/publication.rb', line 3 def volume @volume end |
Class Method Details
.parse(publications) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sovren/publication.rb', line 5 def self.parse(publications) return Array.new if publications.nil? result = publications.css('Article,Book,ConferencePaper,OtherPublication').collect do |item| c = Publication.new c.type = item.name == "OtherPublication" ? item['type'] : item.name c.title = item.css('Title').text c.role = item.css('Name').first['role'] rescue nil c.publication_date = item.css('PublicationDate').css('YearMonth,Year').first.text rescue nil c.journal_or_serial_name = item.css('JournalOrSerialName').text c.volume = item.css('Volume').text c.issue = item.css('Issue').text c.page_number = item.css('PageNumber').text c.abstract = item.css('Abstract').text c.copyright_date = item.css('Copyright CopyrightDates OriginalDate Year, Copyright CopyrightDates OriginalDate YearMonth').first.text rescue nil c.copyright_text = item.css('Copyright CopyrightText').first.text rescue nil c.edition = item.css('Edition').text c.isbn = item.css('ISBN').text c.publisher_name = item.css('PublisherName').text c.publisher_location = item.css('PublisherLocation').text c.event_name = item.css('EventName').text c.conference_date = Date.parse(item.css('ConferenceDate AnyDate').text) rescue nil c.conference_location = item.css('ConferenceLocation').text c.comments = item.css('Comments').text c.number_of_pages = item.css('NumberOfPages').text.to_i rescue nil c end result end |