Class: UqLibraries::LibraryDetails
- Inherits:
-
Object
- Object
- UqLibraries::LibraryDetails
- Defined in:
- lib/uq_libraries/library_details.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#available ⇒ Object
readonly
Returns the value of attribute available.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#out_of_available ⇒ Object
readonly
Returns the value of attribute out_of_available.
Class Method Summary collapse
-
.all ⇒ Object
Getter method for @@all array.
-
.create_from_collection(details_array) ⇒ Object
Creates library_details instance from array of hashes returned by Scraper#scrape_details_page.
Instance Method Summary collapse
-
#initialize(details_hash) ⇒ LibraryDetails
constructor
A new instance of LibraryDetails.
Constructor Details
#initialize(details_hash) ⇒ LibraryDetails
Returns a new instance of LibraryDetails.
5 6 7 8 9 10 11 |
# File 'lib/uq_libraries/library_details.rb', line 5 def initialize(details_hash) @level = details_hash[:level] @available = details_hash[:available] @out_of_available = details_hash[:out_of_available] @@all << self end |
Instance Attribute Details
#available ⇒ Object (readonly)
Returns the value of attribute available.
2 3 4 |
# File 'lib/uq_libraries/library_details.rb', line 2 def available @available end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
2 3 4 |
# File 'lib/uq_libraries/library_details.rb', line 2 def level @level end |
#out_of_available ⇒ Object (readonly)
Returns the value of attribute out_of_available.
2 3 4 |
# File 'lib/uq_libraries/library_details.rb', line 2 def out_of_available @out_of_available end |
Class Method Details
.all ⇒ Object
Getter method for @@all array. Returns all LibraryDetails instances
17 18 19 |
# File 'lib/uq_libraries/library_details.rb', line 17 def self.all # Getter method for @@all array. Returns all LibraryDetails instances @@all end |
.create_from_collection(details_array) ⇒ Object
Creates library_details instance from array of hashes returned by Scraper#scrape_details_page
13 14 15 |
# File 'lib/uq_libraries/library_details.rb', line 13 def self.create_from_collection(details_array) # Creates library_details instance from array of hashes returned by Scraper#scrape_details_page details_array.each {|details_hash| self.new(details_hash)} end |