Class: Method

### Home Classes Methods

### In Files

- lib/parse_tree_extensions.rb

### Parent

Object

### Methods

- #to_ruby
- #to_sexp
- #with_class_and_method_name

### Files

- History.txt
- Manifest.txt
- README.txt

### Class/Module Index

Quicksearch

- Class
- ClassInclude
- Method
- Mod1
- Mod2
- Module
- ParseTree
- ParseTreeGauntlet
- ParseTreeTestCase
- PostUnifier
- PreUnifier
- Proc
- ProcStoreTmp
- R2RTestCase
- RawParseTree
- Something
- SomethingWithInitialize
- TestParseTree
- TestRawParseTree
- TestUnifier
- UnboundMethod
- UnifiedRuby
- Unifier

No matching classes.

# Method

### Public Instance Methods

to_ruby() click to toggle source

    # File lib/parse_tree_extensions.rb, line 24
    def to_ruby
      sexp = self.to_sexp
      Ruby2Ruby.new.process sexp
    end

to_sexp() click to toggle source

    # File lib/parse_tree_extensions.rb, line 13
    def to_sexp
      require 'parse_tree'
      require 'unified_ruby'
      parser = ParseTree.new(false)
      unifier = Unifier.new
      with_class_and_method_name do |klass, method|
        old_sexp = parser.parse_tree_for_method(klass, method)
        unifier.process(old_sexp)
      end
    end

with_class_and_method_name() click to toggle source

    # File lib/parse_tree_extensions.rb, line 2
    def with_class_and_method_name
      if self.inspect =~ /<Method: (.*)\#(.*)>/ then
        klass = eval $1
        method  = $2.intern
        raise "Couldn't determine class from #{self.inspect}" if klass.nil?
        return yield(klass, method)
      else
        raise "Can't parse signature: #{self.inspect}"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.