Sha256: 5f4ce96b847266e1881593c17652b5dc7ecd5121814ca699e2d3fbc90f88ed3d

Contents?: true

Size: 814 Bytes

Versions: 16

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Unparser
  module Writer
    class Rescue
      include Writer, Adamantium

      children :body, :rescue_body

      define_group :rescue_bodies, 1..-2

      def emit_regular
        emit_optional_body(body)

        rescue_bodies.each(&method(:emit_rescue_body))

        if else_node
          write('else')
          emit_body(else_node)
        end
      end

      def emit_heredoc_reminders
        emitter(body).emit_heredoc_reminders
      end

      def emit_postcontrol
        visit(body)
        writer_with(Resbody, rescue_body).emit_postcontrol
      end

    private

      def else_node
        children.last
      end

      def emit_rescue_body(node)
        writer_with(Resbody, node).emit_regular
      end
    end # Rescue
  end # Writer
end # Unparser

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
unparser-0.6.15 lib/unparser/writer/rescue.rb
unparser-0.6.14 lib/unparser/writer/rescue.rb
unparser-0.6.13 lib/unparser/writer/rescue.rb
unparser-0.6.12 lib/unparser/writer/rescue.rb
unparser-0.6.10 lib/unparser/writer/rescue.rb
unparser-0.6.9 lib/unparser/writer/rescue.rb
unparser-0.6.8 lib/unparser/writer/rescue.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/unparser-0.6.7/lib/unparser/writer/rescue.rb
unparser-0.6.7 lib/unparser/writer/rescue.rb
unparser-0.6.6 lib/unparser/writer/rescue.rb
unparser-0.6.5 lib/unparser/writer/rescue.rb
unparser-0.6.4 lib/unparser/writer/rescue.rb
unparser-0.6.3 lib/unparser/writer/rescue.rb
unparser-0.6.2 lib/unparser/writer/rescue.rb
unparser-0.6.1 lib/unparser/writer/rescue.rb
unparser-0.6.0 lib/unparser/writer/rescue.rb