Skip to content
Browse files

Add a helper method to build ClassMirrors

  • Loading branch information...
1 parent e589557 commit 77544e74c43f8f416bc58cffc7495ed1e48c1cd6 @ribrdb ribrdb committed May 25, 2010
Showing with 8 additions and 3 deletions.
  1. +1 −3 bin/bitep
  2. +7 −0 lib/bitescript/mirror.rb
View
4 bin/bitep
@@ -10,6 +10,4 @@ file = ARGV[0]
raise "usage: bitep <class_name>" unless file
-cb = BiteScript::ASM::ClassMirror::Builder.new
-BiteScript::ASM::ClassReader.new(ARGV[0]).accept(cb, 3)
-puts cb.mirror.inspect
+puts BiteScript::ASM::ClassMirror.load(file).inspect
View
7 lib/bitescript/mirror.rb
@@ -175,6 +175,13 @@ def initialize(type, flags)
@interfaces = []
end
+ def self.load(name_or_bytes)
+ builder = BiteScript::ASM::ClassMirror::Builder.new
+ BiteScript::ASM::ClassReader.new(name_or_bytes).accept(builder, 3)
+ builder.mirror
+ end
+ alias for_name load
+
def getConstructor(*arg_types)
@constructors[arg_types]
end

0 comments on commit 77544e7

Please sign in to comment.
Something went wrong with that request. Please try again.