Last active
September 19, 2018 13:50
-
-
Save lain0/48b04f96b6fc3b6cfcce7456c5910936 to your computer and use it in GitHub Desktop.
Revisions
-
lain0 revised this gist
Sep 19, 2018 . No changes.There are no files selected for viewing
-
lain0 revised this gist
Sep 19, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ ``` class Account attr_accessor :name, :date, :email, :notes -
lain0 revised this gist
Sep 19, 2018 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,15 @@ ``` class Account attr_accessor :name, :date, :email, :notes def assign_values(values) values.each_key do |k| self.send("#{k}=",values[k]) end end end user_info = { :name => "Serj", @@ -20,3 +21,4 @@ user_info = { account = Account.new account.assign_values(user_info) puts account.inspect ``` -
lain0 created this gist
Aug 20, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ class Account attr_accessor :name, :date, :email, :notes def assign_values(values) values.each_key do |k| self.send("#{k}=",values[k]) end end end user_info = { :name => "Serj", :date =>"2015-10-13", :email =>"132@mail.ru", :notes => "ok" } account = Account.new account.assign_values(user_info) puts account.inspect