Class: Author

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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(author_id, first_name, last_name, father_name = nil)
  validate_null('author_id', 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 = author_id
  @first_name = first_name
  @last_name = last_name
  @father_name = father_name
end

Instance Attribute Details

#author_idObject (readonly)

Returns the value of attribute author_id.



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

def author_id
  @author_id
end

#father_nameObject (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_nameObject (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_nameObject (readonly)

Returns the value of attribute last_name.



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

def last_name
  @last_name
end