Class: Classifoclc::Work
- Inherits:
-
Object
- Object
- Classifoclc::Work
- Defined in:
- lib/classifoclc/work.rb
Overview
An abstract work. A work is not a physical book, but the conceptual work of which all the physical books are manifestions
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
Instance Method Summary collapse
-
#edition_count ⇒ Integer
Get the number of editions the work has.
-
#editions ⇒ Enumerator<Classifoclc::Edition>
Get the editions of this work.
-
#eholdings ⇒ Integer
Get the number of libraries that hold a digital copy of this work.
-
#format ⇒ String
Get the format.
-
#holdings ⇒ Integer
Get the number of libraries that hold a copy of this work.
-
#initialize(node) ⇒ Work
constructor
A new instance of Work.
-
#itemtype ⇒ String
Get the type of item.
-
#owi ⇒ String
Get the work ID.
-
#recommendations ⇒ Array<Classifoclc::Recommendations>
Get the recommended classifications for this work.
-
#title ⇒ String
Get the title.
Constructor Details
#initialize(node) ⇒ Work
Returns a new instance of Work.
6 7 8 9 10 11 12 |
# File 'lib/classifoclc/work.rb', line 6 def initialize(node) @node = node @work = node.css('work').first @authors = node.css('author'). map{|a| Classifoclc::Author.new(a.text, a['lc'], a['viaf'])} @recommendations = load_recommendations(node) end |
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
5 6 7 |
# File 'lib/classifoclc/work.rb', line 5 def @authors end |
Instance Method Details
#edition_count ⇒ Integer
Get the number of editions the work has
40 41 42 |
# File 'lib/classifoclc/work.rb', line 40 def edition_count @work['editions'].to_i end |
#editions ⇒ Enumerator<Classifoclc::Edition>
Get the editions of this work
58 59 60 61 62 63 64 65 66 |
# File 'lib/classifoclc/work.rb', line 58 def editions Enumerator.new do |e| pages.each do |pg| pg.each do |edition| e << edition end end end end |
#eholdings ⇒ Integer
Get the number of libraries that hold a digital copy of this work
52 53 54 |
# File 'lib/classifoclc/work.rb', line 52 def eholdings @work['eholdings'].to_i end |
#format ⇒ String
Get the format
28 29 30 |
# File 'lib/classifoclc/work.rb', line 28 def format @work['format'] end |
#holdings ⇒ Integer
Get the number of libraries that hold a copy of this work
46 47 48 |
# File 'lib/classifoclc/work.rb', line 46 def holdings @work['holdings'].to_i end |
#itemtype ⇒ String
Get the type of item
34 35 36 |
# File 'lib/classifoclc/work.rb', line 34 def itemtype @work['itemtype'] end |
#owi ⇒ String
Get the work ID
16 17 18 |
# File 'lib/classifoclc/work.rb', line 16 def owi @work['owi'] end |
#recommendations ⇒ Array<Classifoclc::Recommendations>
Get the recommended classifications for this work
70 71 72 |
# File 'lib/classifoclc/work.rb', line 70 def recommendations @recommendations end |
#title ⇒ String
Get the title
22 23 24 |
# File 'lib/classifoclc/work.rb', line 22 def title @work['title'] end |