Class: UwCatalog::Location
- Inherits:
-
Object
- Object
- UwCatalog::Location
- Defined in:
- lib/uw_catalog/model/location.rb
Instance Attribute Summary collapse
-
#holdings ⇒ Object
Returns the value of attribute holdings.
-
#id ⇒ Object
Returns the value of attribute id.
-
#location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
- #==(another_loc) ⇒ Object
- #add_holding(holding) ⇒ Object
- #display_location ⇒ Object
- #get_holding(holding) ⇒ Object
-
#initialize(h = Hash.new) ⇒ Location
constructor
A new instance of Location.
Constructor Details
#initialize(h = Hash.new) ⇒ Location
Returns a new instance of Location.
6 7 8 9 |
# File 'lib/uw_catalog/model/location.rb', line 6 def initialize(h=Hash.new) @holdings = Array.new h.each {|k,v| send("#{k}=",v)} end |
Instance Attribute Details
#holdings ⇒ Object
Returns the value of attribute holdings.
4 5 6 |
# File 'lib/uw_catalog/model/location.rb', line 4 def holdings @holdings end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/uw_catalog/model/location.rb', line 4 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/uw_catalog/model/location.rb', line 4 def location @location end |
Instance Method Details
#==(another_loc) ⇒ Object
11 12 13 |
# File 'lib/uw_catalog/model/location.rb', line 11 def ==(another_loc) self.id == another_loc.id end |
#add_holding(holding) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/uw_catalog/model/location.rb', line 19 def add_holding(holding) idx = @holdings.index(holding) if idx.nil? holdings << holding end end |
#display_location ⇒ Object
15 16 17 |
# File 'lib/uw_catalog/model/location.rb', line 15 def display_location location end |
#get_holding(holding) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/uw_catalog/model/location.rb', line 26 def get_holding(holding) idx = @holdings.index(holding) if idx.nil? nil else @holdings.at(idx) end end |