title: How are respond_to and respond_to_missing different?
body: <p>I'm confused when to use each of this methods. 
  From <code>respond_to?</code> documentation: </p>
  
  <blockquote>
    <p>Returns true if <em>obj</em> responds to the given method. Private methods
    are included in the search only if the optional second parameter
    evaluates to true.</p>
    
    <p>If the method is not implemented, as Process.fork on Windows,
    File.lchmod on GNU/Linux, etc., false is returned.</p>
    
    <p>If the method is not defined, respond_to_missing? method is called and
    the result is returned.</p>
  </blockquote>
  
  <p>And <code>respond_to_missing?</code>:</p>
  
  <blockquote>
    <p>Hook method to return whether the <em>obj</em> can respond to <em>id</em> method or
    not.</p>
    
    <p>See #respond_to?.</p>
  </blockquote>
  
  <p>Both methods takes 2 arguments.<br>
  Both methods seems to the same thing(check if some object respond to given method) so why we should use(have) both?</p>
  
  <p>Defining 'resond_to_missing?` gives you ability to take methods:</p>
  
  <pre><code>class A
    def method_missing name, *args, &amp;block
      if name == :meth1
        puts 'YES!'
      else
        raise NoMethodError
      end
    end
  
    def respond_to_missing? name, flag = true
      if name == :meth1
        true
      else
        false
      end
    end
  end
  
  [65] pry(main)&gt; A.new.method :meth1
  # =&gt; #&lt;Method: A#meth1&gt;
  </code></pre>
  
  <p>Why <code>respond_to?</code> couldn't do this? </p>
  
  <h3>What I guess:</h3>
  
  <p><code>respond_to?</code> checks if method is in:</p>
  
  <ol>
  <li>Current object.  </li>
  <li>Parent object.   </li>
  <li>Included modules.  </li>
  </ol>
  
  <p><code>respond_to_missing?</code> checks if method is:</p>
  
  <ol>
  <li>Defined via <code>method_missing</code>:</li>
  </ol>
  
  <p>Via array of possible methods:  </p>
  
  <pre><code>def method_missing name, *args, &amp;block
    arr = [:a, :b, :c]
    if arr.include? name
      puts name
    else
      raise NoMethodError
    end
  end
  </code></pre>
  
  <p>Delegating it to different object:</p>
  
  <pre><code>class A
    def initialize name
      @str = String name
    end
  
    def method_missing name, *args, &amp;block
      @str.send name, *args, &amp;block
    end
  end
  </code></pre>
  
  <p>2 . Other way that I'm not aware of.</p>
  
  <h3>Where should both be defined/used(my guessing too):</h3>
  
  <p>Starting from 1.9.3(as fair I remember) define only <code>respond_to_missing?</code> but use only <code>respond_to?</code></p>
  
  <h3><em>Last questions</em>:</h3>
  
  <p>Am I right? Did I missed something? Correct everything that is bad and/or answer questions asked in this <em>question</em>.</p>