Class: Student
- Inherits:
-
Object
- Object
- Student
- Defined in:
- lib/common_tools/student.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Student
constructor
A new instance of Student.
- #to_json(args) ⇒ Object
Constructor Details
#initialize(args) ⇒ Student
Returns a new instance of Student.
4 5 6 7 8 |
# File 'lib/common_tools/student.rb', line 4 def initialize(args) args.each do |key, value| self.public_send("#{key}=", value ) end end |
Class Method Details
.build_attributes(headers) ⇒ Object
10 11 12 13 14 |
# File 'lib/common_tools/student.rb', line 10 def self.build_attributes(headers) headers.each do |header| attr_accessor header.to_sym end end |
Instance Method Details
#to_json(args) ⇒ Object
16 17 18 19 20 |
# File 'lib/common_tools/student.rb', line 16 def to_json(args) hash = {} self.instance_variables.each{ |var| hash[var.to_s.delete("@")] = self.instance_variable_get(var) } hash.to_json end |