moving to instance variables in parfait

This commit is contained in:
2019-09-09 20:26:54 +03:00
parent fc8de10964
commit 81e3c0c270
21 changed files with 212 additions and 187 deletions

View File

@ -18,7 +18,7 @@ module Parfait
def method_names
names = List.new
self.methods.each do |method|
methods.each do |method|
names.push method.name
end
names
@ -31,13 +31,13 @@ module Parfait
def remove_instance_method( method_name )
found = get_instance_method( method_name )
found ? self.methods.delete(found) : false
found ? @methods.delete(found) : false
end
def get_instance_method( fname )
raise "get_instance_method #{fname}.#{fname.class}" unless fname.is_a?(Symbol)
#if we had a hash this would be easier. Detect or find would help too
self.instance_methods.find {|m| m.name == fname }
@instance_methods.find {|m| m.name == fname }
end
# get the method and if not found, try superclasses. raise error if not found
@ -46,7 +46,7 @@ module Parfait
method = get_instance_method(m_name)
return method if method
if( super_class_name && super_class_name != :Object )
method = self.super_class.resolve_method(m_name)
method = @super_class.resolve_method(m_name)
end
method
end