Class: Order

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bookObject

Returns the value of attribute book.



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

def book
  @book
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#readerObject

Returns the value of attribute reader.



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

def reader
  @reader
end

Instance Method Details

#to_hObject



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