Class: Order
- Inherits:
-
Object
- Object
- Order
- Defined in:
- lib/order.rb
Instance Attribute Summary collapse
-
#book ⇒ Object
Returns the value of attribute book.
-
#date ⇒ Object
Returns the value of attribute date.
-
#reader ⇒ Object
Returns the value of attribute reader.
Instance Method Summary collapse
-
#initialize(book, reader, date) ⇒ Order
constructor
A new instance of Order.
- #to_h ⇒ Object
Constructor Details
#initialize(book, reader, date) ⇒ Order
Returns a new instance of Order.
4 5 6 7 8 |
# File 'lib/order.rb', line 4 def initialize(book, reader, date) @book = book @reader = reader @date = date end |
Instance Attribute Details
#book ⇒ Object
Returns the value of attribute book.
2 3 4 |
# File 'lib/order.rb', line 2 def book @book end |
#date ⇒ Object
Returns the value of attribute date.
2 3 4 |
# File 'lib/order.rb', line 2 def date @date end |
#reader ⇒ Object
Returns the value of attribute reader.
2 3 4 |
# File 'lib/order.rb', line 2 def reader @reader end |
Instance Method Details
#to_h ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/order.rb', line 10 def to_h { book: book.title, reader: reader.name, date: date } end |