Class: Student_short
- Inherits:
-
Super_Student
- Object
- Super_Student
- Student_short
- Defined in:
- lib/files/student_short.rb
Instance Attribute Summary collapse
-
#Contact ⇒ Object
readonly
Returns the value of attribute Contact.
-
#Git ⇒ Object
readonly
Returns the value of attribute Git.
-
#ID ⇒ Object
readonly
Returns the value of attribute ID.
-
#Initials ⇒ Object
readonly
Returns the value of attribute Initials.
-
#Surname ⇒ Object
readonly
Returns the value of attribute Surname.
Attributes inherited from Super_Student
Class Method Summary collapse
Instance Method Summary collapse
- #contact ⇒ Object
- #contact? ⇒ Boolean
- #getInfo ⇒ Object
-
#initialize(id:, surname:, initials:, git:, contact:) ⇒ Student_short
constructor
A new instance of Student_short.
- #short_name ⇒ Object
- #to_s ⇒ Object
Methods inherited from Super_Student
acc_valid?, id_valid?, name_valid?
Constructor Details
#initialize(id:, surname:, initials:, git:, contact:) ⇒ Student_short
Returns a new instance of Student_short.
6 7 8 9 10 11 12 |
# File 'lib/files/student_short.rb', line 6 def initialize(id:, surname:, initials:, git:, contact:) @ID = id @Surname = surname @Initials = initials @Git = git @Contact = contact end |
Instance Attribute Details
#Contact ⇒ Object (readonly)
Returns the value of attribute Contact.
5 6 7 |
# File 'lib/files/student_short.rb', line 5 def Contact @Contact end |
#Git ⇒ Object (readonly)
Returns the value of attribute Git.
5 6 7 |
# File 'lib/files/student_short.rb', line 5 def Git @Git end |
#ID ⇒ Object (readonly)
Returns the value of attribute ID.
5 6 7 |
# File 'lib/files/student_short.rb', line 5 def ID @ID end |
#Initials ⇒ Object (readonly)
Returns the value of attribute Initials.
5 6 7 |
# File 'lib/files/student_short.rb', line 5 def Initials @Initials end |
#Surname ⇒ Object (readonly)
Returns the value of attribute Surname.
5 6 7 |
# File 'lib/files/student_short.rb', line 5 def Surname @Surname end |
Class Method Details
.from_student(student) ⇒ Object
14 15 16 |
# File 'lib/files/student_short.rb', line 14 def self.from_student(student) Student_short.new(id:student.ID, surname:student.Surname, initials:"#{student.Name[0]}. #{student.Father_name[0]}.", git:student.Git, contact:student.contact) end |
.parse_str(str) ⇒ Object
18 19 20 |
# File 'lib/files/student_short.rb', line 18 def self.parse_str(str) Student_short.from_student(Student.parse_str(str)) end |
Instance Method Details
#contact ⇒ Object
34 35 36 |
# File 'lib/files/student_short.rb', line 34 def contact @Contact end |
#contact? ⇒ Boolean
42 43 44 |
# File 'lib/files/student_short.rb', line 42 def contact? !@Contact.nil? end |
#getInfo ⇒ Object
38 39 40 |
# File 'lib/files/student_short.rb', line 38 def getInfo return self.short_name+@Git end |
#short_name ⇒ Object
22 23 24 |
# File 'lib/files/student_short.rb', line 22 def short_name "#{@Surname} #{@Initials}" end |
#to_s ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/files/student_short.rb', line 26 def to_s result = short_name result += ", id=#{@ID} " unless @ID.nil? result += ", git=#{@Git} " unless @Git.nil? result += @Contact unless @Contact.nil? result end |