Sha256: e257ff801bed2ce4285068c612297721aed18c679cbcd2869dec6c3d747ba9ce
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
require "introspection/receivers" require "metaid" module Introspection class Snapshot attr_reader :methods def initialize(object) @methods = object.receivers.map do |receiver| [:public, :protected, :private].map do |visibility| query_method = "#{visibility}_instance_methods" receiver.send(query_method, false).map do |method| unbound_method = receiver.instance_method(method) if unbound_method.owner.equal?(receiver) Method.new(unbound_method, visibility) end end.compact end end.flatten end def diff(other) { :added => other.methods - methods, :removed => methods - other.methods } end def changed?(other) diff(other).values.flatten.any? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
introspection-0.0.1 | lib/introspection/snapshot.rb |