Class: Book
- Inherits:
-
Object
- Object
- Book
- Defined in:
- lib/models/book.rb
Instance Attribute Summary collapse
-
#author_id ⇒ Object
readonly
Returns the value of attribute author_id.
-
#book_id ⇒ Object
readonly
Returns the value of attribute book_id.
-
#publisher_id ⇒ Object
readonly
Returns the value of attribute publisher_id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(book_id, title, author_id, publisher_id) ⇒ Book
constructor
A new instance of Book.
Constructor Details
#initialize(book_id, title, author_id, publisher_id) ⇒ Book
Returns a new instance of Book.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/models/book.rb', line 4 def initialize(book_id, title, , publisher_id) validate_null('book_id', book_id) validate_null('title', title) validate_null('author_id', ) validate_null('publisher_id', publisher_id) validate_title_length(title) @book_id = book_id @title = title @author_id = @publisher_id = publisher_id end |
Instance Attribute Details
#author_id ⇒ Object (readonly)
Returns the value of attribute author_id.
2 3 4 |
# File 'lib/models/book.rb', line 2 def @author_id end |
#book_id ⇒ Object (readonly)
Returns the value of attribute book_id.
2 3 4 |
# File 'lib/models/book.rb', line 2 def book_id @book_id end |
#publisher_id ⇒ Object (readonly)
Returns the value of attribute publisher_id.
2 3 4 |
# File 'lib/models/book.rb', line 2 def publisher_id @publisher_id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/models/book.rb', line 2 def title @title end |