Class: Library
- Inherits:
-
Object
- Object
- Library
- Defined in:
- lib/lib_stats/library.rb
Instance Attribute Summary collapse
-
#checkouts ⇒ Object
Returns the value of attribute checkouts.
-
#name ⇒ Object
Returns the value of attribute name.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Library
constructor
A new instance of Library.
- #performance ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Library
Returns a new instance of Library.
4 5 6 7 8 |
# File 'lib/lib_stats/library.rb', line 4 def initialize(args= {}) @name = args[:name] || librarysoup @quantity = args[:quantity] || 0 @checkouts = args[:checkouts] || 0 end |
Instance Attribute Details
#checkouts ⇒ Object
Returns the value of attribute checkouts.
2 3 4 |
# File 'lib/lib_stats/library.rb', line 2 def checkouts @checkouts end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/lib_stats/library.rb', line 2 def name @name end |
#quantity ⇒ Object
Returns the value of attribute quantity.
2 3 4 |
# File 'lib/lib_stats/library.rb', line 2 def quantity @quantity end |
Instance Method Details
#performance ⇒ Object
11 12 13 |
# File 'lib/lib_stats/library.rb', line 11 def performance return @checkouts.fdiv(@quantity).round(3) end |