Sha256: f40d2b8570a3427f41228c2da9ca17f0e8fc69821804c55ab6dcf7316e21e1ff
Contents?: true
Size: 905 Bytes
Versions: 14
Compression:
Stored size: 905 Bytes
Contents
#!/usr/local/bin/ruby -ws require 'pp' begin require 'rubygems' rescue LoadError end require 'parse_tree' def discover_new_classes_from old_classes = [] ObjectSpace.each_object(Module) do |klass| old_classes << klass end yield new_classes = [] ObjectSpace.each_object(Module) do |klass| new_classes << klass end new_classes -= old_classes new_classes = [ eval($c) ] if defined? $c new_classes end $f = false unless defined? $f new_classes = discover_new_classes_from do ARGV.unshift "-" if ARGV.empty? ARGV.each do |name| if name == "-" then code = $stdin.read code = "class Example; def example; #{code}; end; end" if $f eval code unless code.nil? else require name end end end result = ParseTree.new.parse_tree(*new_classes) result = result[0][3][2][1][2..-1] if $f unless defined? $q then pp result else p result end
Version data entries
14 entries across 12 versions & 2 rubygems