Skip to content

Instantly share code, notes, and snippets.

@lain0
Last active September 19, 2018 13:50
Show Gist options
  • Select an option

  • Save lain0/48b04f96b6fc3b6cfcce7456c5910936 to your computer and use it in GitHub Desktop.

Select an option

Save lain0/48b04f96b6fc3b6cfcce7456c5910936 to your computer and use it in GitHub Desktop.

Revisions

  1. lain0 revised this gist Sep 19, 2018. No changes.
  2. lain0 revised this gist Sep 19, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    ```
    class Account
    attr_accessor :name, :date, :email, :notes
  3. lain0 revised this gist Sep 19, 2018. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions gistfile1.txt
    Original 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])
    def assign_values(values)
    values.each_key do |k|
    self.send("#{k}=",values[k])
    end
    end
    end
    end

    user_info = {
    :name => "Serj",
    @@ -20,3 +21,4 @@ user_info = {
    account = Account.new
    account.assign_values(user_info)
    puts account.inspect
    ```
  4. lain0 created this gist Aug 20, 2016.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original 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