Class: UqLibraries::LibraryDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/uq_libraries/library_details.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#availableObject (readonly)

Returns the value of attribute available.



2
3
4
# File 'lib/uq_libraries/library_details.rb', line 2

def available
  @available
end

#levelObject (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_availableObject (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

.allObject

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