@@ -433,7 +433,7 @@ def pretty_print(q) # :nodoc:
433433class File < IO # :nodoc:
434434 class Stat # :nodoc:
435435 def pretty_print ( q ) # :nodoc:
436- require 'etc.so '
436+ require 'etc'
437437 q . object_group ( self ) {
438438 q . breakable
439439 q . text sprintf ( "dev=0x%x" , self . dev ) ; q . comma_breakable
@@ -539,37 +539,39 @@ def pretty_print(q) # :nodoc:
539539 end
540540end
541541
542- class RubyVM ::AbstractSyntaxTree ::Node
543- def pretty_print_children ( q , names = [ ] )
544- children . zip ( names ) do |c , n |
545- if n
546- q . breakable
547- q . text "#{ n } :"
548- end
549- q . group ( 2 ) do
550- q . breakable
551- q . pp c
542+ if defined? ( RubyVM ::AbstractSyntaxTree )
543+ class RubyVM ::AbstractSyntaxTree ::Node
544+ def pretty_print_children ( q , names = [ ] )
545+ children . zip ( names ) do |c , n |
546+ if n
547+ q . breakable
548+ q . text "#{ n } :"
549+ end
550+ q . group ( 2 ) do
551+ q . breakable
552+ q . pp c
553+ end
552554 end
553555 end
554- end
555556
556- def pretty_print ( q )
557- q . group ( 1 , "(#{ type } @#{ first_lineno } :#{ first_column } -#{ last_lineno } :#{ last_column } " , ")" ) {
558- case type
559- when :SCOPE
560- pretty_print_children ( q , %w" tbl args body " )
561- when :ARGS
562- pretty_print_children ( q , %w[ pre_num pre_init opt first_post post_num post_init rest kw kwrest block ] )
563- when :DEFN
564- pretty_print_children ( q , %w[ mid body ] )
565- when :ARYPTN
566- pretty_print_children ( q , %w[ const pre rest post ] )
567- when :HSHPTN
568- pretty_print_children ( q , %w[ const kw kwrest ] )
569- else
570- pretty_print_children ( q )
571- end
572- }
557+ def pretty_print ( q )
558+ q . group ( 1 , "(#{ type } @#{ first_lineno } :#{ first_column } -#{ last_lineno } :#{ last_column } " , ")" ) {
559+ case type
560+ when :SCOPE
561+ pretty_print_children ( q , %w" tbl args body " )
562+ when :ARGS
563+ pretty_print_children ( q , %w[ pre_num pre_init opt first_post post_num post_init rest kw kwrest block ] )
564+ when :DEFN
565+ pretty_print_children ( q , %w[ mid body ] )
566+ when :ARYPTN
567+ pretty_print_children ( q , %w[ const pre rest post ] )
568+ when :HSHPTN
569+ pretty_print_children ( q , %w[ const kw kwrest ] )
570+ else
571+ pretty_print_children ( q )
572+ end
573+ }
574+ end
573575 end
574576end
575577
0 commit comments