Class: Student

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

Constant Summary collapse

STUDENTS =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Student

Returns a new instance of Student.



9
10
11
12
13
# File 'lib/student.rb', line 9

def initialize(attributes)
  attributes.each do |k, v|
    self.send(("#{k}="), v)
  end
end

Instance Attribute Details

#github_urlObject

Returns the value of attribute github_url.



3
4
5
# File 'lib/student.rb', line 3

def github_url
  @github_url
end

#karmaObject

Returns the value of attribute karma.



3
4
5
# File 'lib/student.rb', line 3

def karma
  @karma
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/student.rb', line 3

def location
  @location
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/student.rb', line 3

def name
  @name
end

#profile_urlObject

Returns the value of attribute profile_url.



3
4
5
# File 'lib/student.rb', line 3

def profile_url
  @profile_url
end

Class Method Details

.allObject



27
28
29
# File 'lib/student.rb', line 27

def self.all
  STUDENTS
end

.create_from_collection(students_array) ⇒ Object



15
16
17
18
19
# File 'lib/student.rb', line 15

def self.create_from_collection(students_array)
   students_array.each do |student|
    Student.new(student)
  end
end

Instance Method Details

#add_student_attributes(attributes_hash) ⇒ Object



21
22
23
24
25
# File 'lib/student.rb', line 21

def add_student_attributes(attributes_hash)
  attributes_hash.each do |k,v|
    self.send(("#{k}="), v)
  end
end