kw'>def</span> <span class='id identifier rubyid_type_cast'>type_cast</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='id identifier rubyid_val