123456789_123456789_123456789_123456789_123456789_

Class: Prism::Translation::Ripper::SexpBuilderPP

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, SexpBuilder, Ripper
Instance Chain:
self, SexpBuilder, Ripper
Inherits: Prism::Translation::Ripper::SexpBuilder
Defined in: lib/prism/translation/ripper/sexp.rb

Overview

This class mirrors the ::Ripper::SexpBuilderPP subclass of Ripper that returns the same values as ::Ripper::SexpBuilder except with a couple of niceties that flatten linked lists into arrays.

Instance Attribute Summary

SexpBuilder - Inherited

Instance Method Summary

Instance Method Details

#_dispatch_event_new (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 87

def _dispatch_event_new
  []
end

#_dispatch_event_push(list, item) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 91

def _dispatch_event_push(list, item)
  list.push item
  list
end

#on_heredoc_dedent(val, width) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 74

def on_heredoc_dedent(val, width)
  val.map! do |e|
    next e if Symbol === e and /_content\z/ =~ e
    if Array === e and e[0] == :@tstring_content
      e = dedent_element(e, width)
    elsif String === e
      dedent_string(e, width)
    end
    e
  end
  val
end

#on_mlhs_add_post(list, post) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 104

def on_mlhs_add_post(list, post)
  list.concat(post)
end

#on_mlhs_add_star(list, star) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 100

def on_mlhs_add_star(list, star)
  list.push([:rest_param, star])
end

#on_mlhs_paren(list) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 96

def on_mlhs_paren(list)
  [:mlhs, *list]
end