Class: Student
- Inherits:
-
Object
- Object
- Student
- Defined in:
- lib/student.rb
Constant Summary collapse
- STUDENTS =
[]
Instance Attribute Summary collapse
-
#github_url ⇒ Object
Returns the value of attribute github_url.
-
#karma ⇒ Object
Returns the value of attribute karma.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#profile_url ⇒ Object
Returns the value of attribute profile_url.
Class Method Summary collapse
Instance Method Summary collapse
- #add_student_attributes(attributes_hash) ⇒ Object
-
#initialize(attributes) ⇒ Student
constructor
A new instance of Student.
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_url ⇒ Object
Returns the value of attribute github_url.
3 4 5 |
# File 'lib/student.rb', line 3 def github_url @github_url end |
#karma ⇒ Object
Returns the value of attribute karma.
3 4 5 |
# File 'lib/student.rb', line 3 def karma @karma end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/student.rb', line 3 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/student.rb', line 3 def name @name end |
#profile_url ⇒ Object
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
.all ⇒ Object
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 |