title: Check if a string contains only digits in ruby
body: <p>I have a string which is passed as a parameter to a function. Here, I want to check if the string contains only numbers. So I had a check like below:</p>
  
  <pre><code>def check_string(string)
    result = false
    if string.to_i.to_s.eql? string
      result =  true
    end
    result
  end
  </code></pre>
  
  <p>But the problem arises when a string starts with 0. In that case, a false is returned.</p>
  
  <pre><code>check_string('123')  #=&gt; true
  check_string('0123') #=&gt; false
  </code></pre>
  
  <p>How can I solve this issue?</p>