Last active
December 3, 2018 14:19
-
-
Save Bijendra/7fe1f632015d90eb9c516116eb36260c to your computer and use it in GitHub Desktop.
Ruby Meta Blogspot Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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