Class: WorkTogether::Student
- Inherits:
-
Object
- Object
- WorkTogether::Student
- Defined in:
- lib/work_together.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#active_track ⇒ Object
Returns the value of attribute active_track.
-
#completion ⇒ Object
Returns the value of attribute completion.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#github_username ⇒ Object
Returns the value of attribute github_username.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Student
constructor
A new instance of Student.
- #name ⇒ Object
- #progress ⇒ Object
Constructor Details
#initialize ⇒ Student
102 103 104 |
# File 'lib/work_together.rb', line 102 def initialize @@all << self end |
Instance Attribute Details
#active_track ⇒ Object
Returns the value of attribute active_track.
100 101 102 |
# File 'lib/work_together.rb', line 100 def active_track @active_track end |
#completion ⇒ Object
Returns the value of attribute completion.
100 101 102 |
# File 'lib/work_together.rb', line 100 def completion @completion end |
#email ⇒ Object
Returns the value of attribute email.
100 101 102 |
# File 'lib/work_together.rb', line 100 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
100 101 102 |
# File 'lib/work_together.rb', line 100 def first_name @first_name end |
#github_username ⇒ Object
Returns the value of attribute github_username.
100 101 102 |
# File 'lib/work_together.rb', line 100 def github_username @github_username end |
#last_name ⇒ Object
Returns the value of attribute last_name.
100 101 102 |
# File 'lib/work_together.rb', line 100 def last_name @last_name end |
Class Method Details
.all ⇒ Object
106 107 108 |
# File 'lib/work_together.rb', line 106 def self.all @@all end |
.generate_from_data(data) ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/work_together.rb', line 118 def self.generate_from_data(data) data.each do |student_hash| student_hash.delete_if {|attribute, value| !Student.instance_methods.include?(attribute.to_sym)} self.new.tap do |student| student_hash.each do |attribute, value| student.public_send("#{attribute}=", value) end end end end |
Instance Method Details
#name ⇒ Object
110 111 112 |
# File 'lib/work_together.rb', line 110 def name "#{first_name} #{last_name}" end |
#progress ⇒ Object
114 115 116 |
# File 'lib/work_together.rb', line 114 def progress self.completion end |