Sha256: 2c0167104def8dc589886bf93132d4f5908cf1755a0c9a3c68a7c37ef1e01722
Contents?: true
Size: 720 Bytes
Versions: 2
Compression:
Stored size: 720 Bytes
Contents
module Mutant class Method < Rubinius::Melbourne attr_reader :ast, :source_name, :source_file, :source_line DEFAULT_LINE = 1 def initialize(method) @ast = nil @source_name = method.name.to_sym @source_file, @source_line = method.source_location super(source_file, DEFAULT_LINE) end # TODO: Check for edge cases where just the line won't work. def match?(ast) source_line == ast.line end end class InstanceMethod < Method def process_defn(*) super.tap { |ast| @ast = ast if match?(ast) } end end class SingletonMethod < Method def process_defs(*) super.tap { |ast| @ast = ast if match?(ast.body) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mutant-0.1.1 | lib/mutant/method.rb |
mutant-0.1.0 | lib/mutant/method.rb |