Sha256: 32e62f111a69d66e95bc5a638de44389b12d0624b30a3f9847b92889fa2e7fbf

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

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

        class Ruby

          def call(template)
            <<-STRING
              output = begin
                #{template.source}
              end
              output#{suffix(template.type.symbol)}
            STRING
          end

          private

          def suffix(type)
            if %i(json xml).include?(type)
              ".to_#{type}"
            end
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tuning-4.0.1.1 lib/tuning/extensions/action_view/handlers.rb
tuning-4.0.1.0 lib/tuning/extensions/action_view/handlers.rb