Skip to content

Commit

Permalink
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions truffle/src/main/ruby/core/rubinius/primitives.rb
Original file line number Diff line number Diff line change
@@ -10,24 +10,27 @@ module Rubinius
module RubyPrimitives

def self.module_mirror(obj)
if obj.is_a?(::Numeric)
Rubinius::Mirror::Numeric
else
begin
Rubinius::Mirror.const_get(obj.class.name.to_sym, false)
rescue NameError
ancestor = obj.class.superclass

until ancestor.nil?
begin
return Rubinius::Mirror.const_get(ancestor.name.to_sym, false)
rescue NameError
ancestor = ancestor.superclass
case obj
when ::Numeric then Rubinius::Mirror::Numeric
when ::String then Rubinius::Mirror::String
when ::Range then Rubinius::Mirror::Range
when ::Process then Rubinius::Mirror::Process
else
begin
Rubinius::Mirror.const_get(obj.class.name.to_sym, false)
rescue NameError
ancestor = obj.class.superclass

until ancestor.nil?
begin
return Rubinius::Mirror.const_get(ancestor.name.to_sym, false)
rescue NameError
ancestor = ancestor.superclass
end
end
end

nil
end
nil
end
end
end

0 comments on commit b6a6716

Please sign in to comment.