Method: Code.from_ruby
- Defined in:
- lib/code.rb
.from_ruby(m) ⇒ Object
Find Ruby definition of code
39 40 41 42 43 44 45 46 47 |
# File 'lib/code.rb', line 39 def self.from_ruby(m) source = m.source || "" indent = source.match(/\A +/) source = source.gsub(/^#{indent}/,"") comment = m.comment && !m.comment.empty? ? "#{ m.comment }" : "" location = m.source_location ? "#\n# #{ m.source_location*':' }\n#\n" : "" display location + comment + source end |