Class: Publisher
- Inherits:
-
Object
- Object
- Publisher
- 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
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#publisher_id ⇒ Object
readonly
Returns the value of attribute publisher_id.
Instance Method Summary collapse
-
#initialize(publisher_id, name, email = nil) ⇒ Publisher
constructor
A new instance of Publisher.
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
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/models/publisher.rb', line 4 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/models/publisher.rb', line 4 def name @name end |
#publisher_id ⇒ Object (readonly)
Returns the value of attribute publisher_id.
4 5 6 |
# File 'lib/models/publisher.rb', line 4 def publisher_id @publisher_id end |