Sha256: 0fbb044c967966a18e8a0dac43001442fd3eb22dbdae8695529a61151ca9ef17

Contents?: true

Size: 501 Bytes

Versions: 6

Compression:

Stored size: 501 Bytes

Contents

module MethodOrigin
  # An abstraction for a method origin.
  class Origin
    attr_reader :file, :line

    def initialize(file, line)
      @file = file
      @line = line
    end

    def to_s
      return "#{file}:#{line}"
    end
  end

  # Return a Method::Origin representing where the method was defined.
  def origin
    block = body().next
    return Origin.new(block.nd_file, block.nd_line)
  end
end

class Method
  include MethodOrigin
end

class UnboundMethod
  include MethodOrigin
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ruby-decompiler-0.0.3 lib/decompiler/method/origin.rb
ruby-decompiler-0.0.2 lib/decompiler/method/origin.rb
ruby-decompiler-0.0.1 lib/decompiler/method/origin.rb
ruby-internal-0.8.2 lib/internal/method/origin.rb
ruby-internal-0.8.1 lib/internal/method/origin.rb
ruby-internal-0.8.0 lib/internal/method/origin.rb