Class: UwCatalog::Holding
- Inherits:
-
Object
- Object
- UwCatalog::Holding
- Defined in:
- lib/uw_catalog/model/holding.rb
Instance Attribute Summary collapse
-
#call_number ⇒ Object
Returns the value of attribute call_number.
-
#id ⇒ Object
Returns the value of attribute id.
-
#item_enum ⇒ Object
Returns the value of attribute item_enum.
-
#items ⇒ Object
Returns the value of attribute items.
-
#perm_location ⇒ Object
Returns the value of attribute perm_location.
-
#perm_location_id ⇒ Object
Returns the value of attribute perm_location_id.
Instance Method Summary collapse
- #==(another_holding) ⇒ Object
- #add_item(item) ⇒ Object
- #get_items_display(concise = false) ⇒ Object
-
#initialize(h = Hash.new) ⇒ Holding
constructor
A new instance of Holding.
- #library_has ⇒ Object
Constructor Details
#initialize(h = Hash.new) ⇒ Holding
Returns a new instance of Holding.
5 6 7 8 |
# File 'lib/uw_catalog/model/holding.rb', line 5 def initialize(h=Hash.new) @items = Array.new h.each {|k,v| send("#{k}=",v)} end |
Instance Attribute Details
#call_number ⇒ Object
Returns the value of attribute call_number.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def call_number @call_number end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def id @id end |
#item_enum ⇒ Object
Returns the value of attribute item_enum.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def item_enum @item_enum end |
#items ⇒ Object
Returns the value of attribute items.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def items @items end |
#perm_location ⇒ Object
Returns the value of attribute perm_location.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def perm_location @perm_location end |
#perm_location_id ⇒ Object
Returns the value of attribute perm_location_id.
3 4 5 |
# File 'lib/uw_catalog/model/holding.rb', line 3 def perm_location_id @perm_location_id end |
Instance Method Details
#==(another_holding) ⇒ Object
10 11 12 |
# File 'lib/uw_catalog/model/holding.rb', line 10 def ==(another_holding) self.id == another_holding.id end |
#add_item(item) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/uw_catalog/model/holding.rb', line 36 def add_item(item) idx = items.index(item) if idx.nil? items << item else item_in_list = items.fetch(idx) if Holding.override_status(item_in_list) elsif Holding.override_status(item) items.delete_at(idx) items << item else if Holding.get_item_rank(item_in_list) > Holding.get_item_rank(item) items.delete_at(idx) items << item end end end end |
#get_items_display(concise = false) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/uw_catalog/model/holding.rb', line 26 def get_items_display(concise = false) ret = Hash.new return ret unless items.size > 0 status_list = item_statuses(concise) ret[:status] = status_list ret end |
#library_has ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/uw_catalog/model/holding.rb', line 14 def library_has ret = Hash.new marc = HoldingMarc.new(@id) val = marc.bound_copies ret[:bound_copies] = val unless (val.nil? or val.empty?) val = marc.indexes ret[:indexes] = val unless (val.nil? or val.empty?) val = marc.supplements ret[:supplements] = val unless (val.nil? or val.empty?) ret end |