Permalink
Browse files

Fix adapter for Rubinius 1.2.3, 1.2.4.

  • Loading branch information...
oggy committed May 21, 2012
1 parent 0c506cd commit 786f8a1f83ae12b77bc8aa14594adb4b256e63de
Showing with 13 additions and 7 deletions.
  1. +10 −5 lib/looksee/adapter/rubinius.rb
  2. +2 −1 spec/adapter_spec.rb
  3. +1 −1 spec/spec_helper.rb
@@ -30,26 +30,31 @@ def internal_private_instance_methods(mod)
def internal_undefined_instance_methods(mod)
names = []
- mod.method_table.each_entry do |entry|
- names << entry.name if entry.visibility.equal?(:undef)
+ mod.method_table.entries.each do |(name, method, visibility)|
+ names << name if visibility.equal?(:undef)
end
names
end
def singleton_class?(object)
- object.is_a?(Class) && object.__metaclass_object__
+ object.is_a?(Class) && !!::Rubinius::Type.singleton_class_object(object)
end
def singleton_instance(singleton_class)
singleton_class?(singleton_class) or
raise TypeError, "expected singleton class, got #{singleton_class.class}"
- singleton_class.__metaclass_object__
+ ::Rubinius::Type.singleton_class_object(singleton_class)
end
def module_name(mod)
mod.is_a?(Module) or
raise TypeError, "expected module, got #{mod.class}"
- mod.__name__
+
+ if ::Rubinius::Type.respond_to?(:module_name)
+ ::Rubinius::Type.module_name(mod)
+ else
+ mod.__name__
+ end
end
def source_location(method)
View
@@ -436,7 +436,8 @@ def to_s
describe "#source_location" do
def load_source(source)
@tmp = "#{ROOT}/spec/tmp"
- @source_path = "#@tmp/c.rb"
+ # rbx 1.2.3 caches the file content by file name - ensure file names are different.
+ @source_path = "#@tmp/c#{__id__}.rb"
FileUtils.mkdir_p @tmp
open(@source_path, 'w') { |f| f.print source }
load @source_path
View
@@ -7,7 +7,7 @@
require 'set'
require 'fileutils'
-ROOT = File.dirname(File.dirname(__FILE__))
+ROOT = File.expand_path('..', File.dirname(__FILE__))
Dir['spec/support/*.rb'].each do |path|
require path

0 comments on commit 786f8a1

Please sign in to comment.