title: Is there a way to view (or print) a method definition programatically in rails?
body: <p>Let's say I have a function called <code>bla</code> defined somewhere in my rails app.</p>
  
  <p>Is there a way in ruby or rails through which I can print the code dynamically/programmatically used to define that function ? So for example:</p>
  
  <pre><code>def bla
     puts "Hi There"
  end
  </code></pre>
  
  <p>and then if I call a function like, for example, <code>get_definition</code>:</p>
  
  <pre><code>puts get_definition(:bla)
  </code></pre>
  
  <p>this would print out</p>
  
  <pre><code>"puts \"Hi There\""
  </code></pre>
  
  <p>Is there a canonical way of doing this ? I haven't actually needed to do this before, and I know this is not really common practice in rails. </p>
  
  <p>I also don't want to define my method using meta (reflective) programming and then store the string used to define my method. Any help is appreciated!</p>