Class: Publisher

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

Constant Summary collapse

EMAIL_REGEX =
/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(publisher_id, name, email = nil) ⇒ Publisher

Returns a new instance of Publisher.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/models/publisher.rb', line 6

def initialize(publisher_id, name, email = nil)
  validate_null('publisher_id', publisher_id)
  validate_null('name', name)

  validate_name_length(name)
  validate_email(email)

  @publisher_id = publisher_id
  @name = name
  @email = email
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



4
5
6
# File 'lib/models/publisher.rb', line 4

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/models/publisher.rb', line 4

def name
  @name
end

#publisher_idObject (readonly)

Returns the value of attribute publisher_id.



4
5
6
# File 'lib/models/publisher.rb', line 4

def publisher_id
  @publisher_id
end