Class: WorkTogether::Student

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStudent



102
103
104
# File 'lib/work_together.rb', line 102

def initialize
  @@all << self
end

Instance Attribute Details

#active_trackObject

Returns the value of attribute active_track.



100
101
102
# File 'lib/work_together.rb', line 100

def active_track
  @active_track
end

#completionObject

Returns the value of attribute completion.



100
101
102
# File 'lib/work_together.rb', line 100

def completion
  @completion
end

#emailObject

Returns the value of attribute email.



100
101
102
# File 'lib/work_together.rb', line 100

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



100
101
102
# File 'lib/work_together.rb', line 100

def first_name
  @first_name
end

#github_usernameObject

Returns the value of attribute github_username.



100
101
102
# File 'lib/work_together.rb', line 100

def github_username
  @github_username
end

#last_nameObject

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

.allObject



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

#nameObject



110
111
112
# File 'lib/work_together.rb', line 110

def name
  "#{first_name} #{last_name}"
end

#progressObject



114
115
116
# File 'lib/work_together.rb', line 114

def progress
  self.completion
end