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