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