Sha256: 73335f57d571d484b51bd737ce0dd6179d29b0acaa52b1a38dfa5d9af5863f31

Contents?: true

Size: 608 Bytes

Versions: 44

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module ActionView #:nodoc:
  # = Action View RawFile Template
  class Template #:nodoc:
    class RawFile #:nodoc:
      attr_accessor :type, :format

      def initialize(filename)
        @filename = filename.to_s
        extname = ::File.extname(filename).delete(".")
        @type = Template::Types[extname] || Template::Types[:text]
        @format = @type.symbol
      end

      def identifier
        @filename
      end

      def render(*args)
        ::File.read(@filename)
      end

      def formats; Array(format); end
      deprecate :formats
    end
  end
end

Version data entries

44 entries across 42 versions & 5 rubygems

Version Path
actionview-6.0.6.1 lib/action_view/template/raw_file.rb
actionview-6.0.6 lib/action_view/template/raw_file.rb
actionview-6.0.5.1 lib/action_view/template/raw_file.rb
actionview-6.0.5 lib/action_view/template/raw_file.rb
actionview-6.0.4.8 lib/action_view/template/raw_file.rb
actionview-6.0.4.7 lib/action_view/template/raw_file.rb
actionview-6.0.4.6 lib/action_view/template/raw_file.rb
actionview-6.0.4.5 lib/action_view/template/raw_file.rb
actionview-6.0.4.4 lib/action_view/template/raw_file.rb
actionview-6.0.4.3 lib/action_view/template/raw_file.rb
actionview-6.0.4.2 lib/action_view/template/raw_file.rb
actionview-6.0.4.1 lib/action_view/template/raw_file.rb
actionview-6.0.4 lib/action_view/template/raw_file.rb
actionview-6.0.3.7 lib/action_view/template/raw_file.rb
actionview-6.0.3.6 lib/action_view/template/raw_file.rb
actionview-6.0.3.5 lib/action_view/template/raw_file.rb
actionview-6.0.3.4 lib/action_view/template/raw_file.rb
actionview-6.0.3.3 lib/action_view/template/raw_file.rb
actionview-6.0.3.2 lib/action_view/template/raw_file.rb
actionview-6.0.3.1 lib/action_view/template/raw_file.rb