Class: Library

Inherits:
Object
  • Object
show all
Defined in:
lib/lib_stats/library.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#checkoutsObject

Returns the value of attribute checkouts.



2
3
4
# File 'lib/lib_stats/library.rb', line 2

def checkouts
  @checkouts
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/lib_stats/library.rb', line 2

def name
  @name
end

#quantityObject

Returns the value of attribute quantity.



2
3
4
# File 'lib/lib_stats/library.rb', line 2

def quantity
  @quantity
end

Instance Method Details

#performanceObject



11
12
13
# File 'lib/lib_stats/library.rb', line 11

def performance
	return @checkouts.fdiv(@quantity).round(3)
end