Sha256: 1549f2e26a68a439981efe613f97e519280b55edd49935989bfd0b3920661679

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module ActionView
  module RenderParser # :nodoc:
    ALL_KNOWN_KEYS = [:partial, :template, :layout, :formats, :locals, :object, :collection, :as, :status, :content_type, :location, :spacer_template]
    RENDER_TYPE_KEYS = [:partial, :template, :layout]

    class Base # :nodoc:
      def initialize(name, code)
        @name = name
        @code = code
      end

      private
        def directory
          File.dirname(@name)
        end

        def partial_to_virtual_path(render_type, partial_path)
          if render_type == :partial || render_type == :layout
            partial_path.gsub(%r{(/|^)([^/]*)\z}, '\1_\2')
          else
            partial_path
          end
        end
    end

    # Check if prism is available. If it is, use it. Otherwise, use ripper.
    begin
      require "prism"
    rescue LoadError
      require "ripper"
      require_relative "render_parser/ripper_render_parser"
      Default = RipperRenderParser
    else
      require_relative "render_parser/prism_render_parser"
      Default = PrismRenderParser
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
actionview-8.0.0 lib/action_view/render_parser.rb
actionview-7.2.2 lib/action_view/render_parser.rb
actionview-8.0.0.rc2 lib/action_view/render_parser.rb
actionview-7.2.1.2 lib/action_view/render_parser.rb
actionview-8.0.0.rc1 lib/action_view/render_parser.rb
actionview-7.2.1.1 lib/action_view/render_parser.rb
actionview-8.0.0.beta1 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha9 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha8 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha7 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha4 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha3 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha2 lib/action_view/render_parser.rb
omg-actionview-8.0.0.alpha1 lib/action_view/render_parser.rb
actionview-7.2.1 lib/action_view/render_parser.rb
actionview-7.2.0 lib/action_view/render_parser.rb
actionview-7.2.0.rc1 lib/action_view/render_parser.rb
actionview-7.2.0.beta3 lib/action_view/render_parser.rb
actionview-7.2.0.beta2 lib/action_view/render_parser.rb
actionview-7.2.0.beta1 lib/action_view/render_parser.rb