title: Ruby pass a parameter in to the constructor to behave like a dynamic method
body: <p>In my admin logs service I want to implement method which ignore specific data from hash which I receive (e.g. admin parameters like <code>email</code> <code>password</code> which are in form - <code>AdminUser.new(form)</code>). At this moment I know which parameters I want to ignore (these are permanent - <code>exclude_params</code> below)</p>
  
  <pre><code>  def exclude_params
      %w[
        reset_password_token
        sign_in_count
        created_at
        updated_at
      ]
    end
  </code></pre>
  
  <p>But I will use this service in many enpoints so I want to do more dynamically method that the call be like <code>LogAdminData.new(old_data: old_data, exclude_params: %i[encrypted_password nick_name]).call</code> in the same time I want to keep base ignored parameters (like the ones above - <code>created_at</code> <code>update_at</code> etc) of this method (so that would just be adding it to the existing array?). Sample of existing service below.</p>
  
  <pre><code>class LogAdminData
    def initialize(old_data:)
      @old_data = old_data.except(exclude_params)
    end
  
    def exclude_params
      %w[
        reset_password_token
        sign_in_count
        created_at
        updated_at
      ]
    end
  end
  </code></pre>