From af9fed863ffc993b8bbf61a50d46fd6904ca132e Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 19 Dec 2016 14:16:10 +0200 Subject: [PATCH] small rename --- lib/typed/method_compiler.rb | 2 +- lib/typed/parfait/type.rb | 6 +++--- test/typed/parfait/test_meta_class.rb | 2 +- test/typed/parfait/test_typed_method.rb | 2 +- test/typed/type/test_method_api.rb | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/typed/method_compiler.rb b/lib/typed/method_compiler.rb index f9182aa6..a0b0c0d5 100644 --- a/lib/typed/method_compiler.rb +++ b/lib/typed/method_compiler.rb @@ -111,7 +111,7 @@ module Typed raise "create_method #{type.inspect} is not a Type" unless type.is_a? Parfait::Type raise "Args must be Hash #{args}" unless args.is_a?(Hash) raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol - arguments = Parfait::Type.new_for_hash( type.object_class , args ) + arguments = Parfait::Type.for_hash( type.object_class , args ) @method = type.create_instance_method( method_name , arguments) self end diff --git a/lib/typed/parfait/type.rb b/lib/typed/parfait/type.rb index 88e5249a..bc96a7a7 100644 --- a/lib/typed/parfait/type.rb +++ b/lib/typed/parfait/type.rb @@ -38,7 +38,7 @@ module Parfait include Indexed self.offset(3) - def self.new_for_hash( object_class , hash) + def self.for_hash( object_class , hash) new_type = Type.new( object_class , hash) code = new_type.hash Space.object_space.types[code] = new_type @@ -83,7 +83,7 @@ module Parfait def create_instance_method( method_name , arguments ) raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol) #puts "Self: #{self.class} clazz: #{clazz.name}" - arguments = Parfait::Type.new_for_hash( self.object_class , arguments) if arguments.is_a?(Hash) + arguments = Parfait::Type.for_hash( self.object_class , arguments) if arguments.is_a?(Hash) add_instance_method TypedMethod.new( self , method_name , arguments ) end @@ -138,7 +138,7 @@ module Parfait if existing return existing else - return Type.new_for_hash( object_class , hash) + return Type.for_hash( object_class , hash) end end diff --git a/test/typed/parfait/test_meta_class.rb b/test/typed/parfait/test_meta_class.rb index be4908aa..9ec93833 100644 --- a/test/typed/parfait/test_meta_class.rb +++ b/test/typed/parfait/test_meta_class.rb @@ -8,7 +8,7 @@ class TestMeta < MiniTest::Test end def foo_method for_class = :Try - args = Parfait::Type.new_for_hash( @try , { bar: :Integer}) + args = Parfait::Type.for_hash( @try , { bar: :Integer}) ::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args end diff --git a/test/typed/parfait/test_typed_method.rb b/test/typed/parfait/test_typed_method.rb index 70ae57bb..cd6e62c5 100644 --- a/test/typed/parfait/test_typed_method.rb +++ b/test/typed/parfait/test_typed_method.rb @@ -4,7 +4,7 @@ class TestMethod < MiniTest::Test def setup obj = Register.machine.space.get_class_by_name(:Object).instance_type - args = Parfait::Type.new_for_hash( obj , { bar: :Integer , foo: :Type}) + args = Parfait::Type.for_hash( obj , { bar: :Integer , foo: :Type}) @method = ::Parfait::TypedMethod.new obj , :meth , args @method.add_local :local_bar , :Integer @method.add_local :local_foo , :Type diff --git a/test/typed/type/test_method_api.rb b/test/typed/type/test_method_api.rb index bff10d9e..bf826996 100644 --- a/test/typed/type/test_method_api.rb +++ b/test/typed/type/test_method_api.rb @@ -8,7 +8,7 @@ class TestMethodApi < MiniTest::Test end def foo_method for_class = :Try - args = Parfait::Type.new_for_hash( @try , { bar: :Integer}) + args = Parfait::Type.for_hash( @try , { bar: :Integer}) ::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args end @@ -33,7 +33,7 @@ class TestMethodApi < MiniTest::Test end end def test_create_method - args = Parfait::Type.new_for_hash( @try , { bar: :Integer}) + args = Parfait::Type.for_hash( @try , { bar: :Integer}) @try.create_instance_method :bar, args assert_equal ":bar" , @try.method_names.inspect end