Sha256: 94c84ff3e534b0561a51737d066bb7e3e089f6a193682d391d7ee1f53613ccb7

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

module Tuning
  module Extensions
    module ActionView
      module Handlers
        extend ActiveSupport::Concern

        class Ruby

          def call(template)
            if template.type.json?
              if File.basename(template.identifier).starts_with?('_')
                template.source
              else
                <<~STRING
                  output = begin
                    #{template.source}
                  end
                  if output.is_a?(String)
                    output
                  else
                    output.to_json
                  end
                STRING
              end
            else
              template.source
            end
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tuning-5.1.3 lib/tuning/extensions/action_view/handlers.rb
tuning-5.1.2 lib/tuning/extensions/action_view/handlers.rb