diff --git a/lib/parfait/object.rb b/lib/parfait/object.rb index ab68aa14..00f649f3 100644 --- a/lib/parfait/object.rb +++ b/lib/parfait/object.rb @@ -34,7 +34,7 @@ module Parfait def get_internal_word(index) name = get_type().name_at(index) return nil unless name - eval "@#{name}" + instance_variable_get("@#{name}".to_sym) end # 1 -based index @@ -43,7 +43,7 @@ module Parfait raise "not type #{@type.class}" unless @type.is_a?(Type) name = @type.name_at(index) raise "object type has no name at index #{index} " unless name - eval "@#{name} = value" + instance_variable_set("@#{name}".to_sym, value) value end @@ -116,7 +116,7 @@ module Parfait end # name comes in as a ruby @var name - def instance_variable_get name + def instance_variable_ged name var = get_instance_variable name.to_s[1 .. -1].to_sym #puts "getting #{name} #{var}" var diff --git a/test/parfait/test_space.rb b/test/parfait/test_space.rb index c2aa8cb4..989059d5 100644 --- a/test/parfait/test_space.rb +++ b/test/parfait/test_space.rb @@ -45,7 +45,7 @@ class TestSpace < MiniTest::Test end def test_types - assert @space.instance_variable_get("@types").is_a? Parfait::Dictionary + assert @space.instance_variable_ged("@types").is_a? Parfait::Dictionary end def test_types_each @@ -55,7 +55,7 @@ class TestSpace < MiniTest::Test end def test_types_hashes - types = @space.instance_variable_get("@types") + types = @space.instance_variable_ged("@types") types.each do |has , type| assert has.is_a?(Fixnum) , has.inspect end diff --git a/test/parfait/type/test_hash.rb b/test/parfait/type/test_hash.rb index 9a7a9242..0100e9b6 100644 --- a/test/parfait/type/test_hash.rb +++ b/test/parfait/type/test_hash.rb @@ -5,7 +5,7 @@ class TypeHash < MiniTest::Test def setup Risc.machine.boot @space = Parfait.object_space - @types = @space.instance_variable_get("@types") + @types = @space.instance_variable_ged("@types") @first = @types.values.first end