Skip to content

Instantly share code, notes, and snippets.

@Bijendra
Last active December 3, 2018 14:19
Show Gist options
  • Save Bijendra/7fe1f632015d90eb9c516116eb36260c to your computer and use it in GitHub Desktop.
Save Bijendra/7fe1f632015d90eb9c516116eb36260c to your computer and use it in GitHub Desktop.
Ruby Meta Blogspot Example
class Employee
attr_accessor :emp_id, :emp_name, :emp_designation, :emp_department
end
emp_data = { emp_id: 1, emp_name: "Employee1", emp_designation: "Level1", emp_department: "Manufacturing"}
emp_obj = Employee.new
emp_obj.emp_id = emp_data[:emp_id]
emp_obj.emp_name = emp_data[:emp_name]
emp_obj.emp_designation = emp_data[:emp_designation]
emp_obj.emp_department = emp_data[:emp_department]
puts emp_obj.inspect
Output:
#<Employee:0x007f8bb0910b20 @emp_id=1, @emp_name="Employee1", @emp_designation="Level1", @emp_department="Manufacturing">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment