Sha256: e8f4ffdf501c7faea6da6c757f85674e213277f1d19a98bd750c75cdc81ec9e8

Contents?: true

Size: 925 Bytes

Versions: 7

Compression:

Stored size: 925 Bytes

Contents

module Hanami
  class Action
    # Glue code for full stack Hanami applications
    #
    # This includes missing rendering logic that it makes sense to include
    # only for web applications.
    #
    # @api private
    # @since 0.3.0
    module Glue
      # Rack environment key that indicates where the action instance is passed
      #
      # @api private
      # @since 0.3.0
      ENV_KEY = 'hanami.action'.freeze

      protected

      # Put the current instance into the Rack environment
      #
      # @api private
      # @since 0.3.0
      #
      # @see Hanami::Action#finish
      def finish(req, *)
        req.env[ENV_KEY] = self
        super
      end

      # Check if the request's body is a file
      #
      # @return [TrueClass,FalseClass] the result of the check
      #
      # @since 0.4.3
      def sending_file?
        response.body.is_a?(::Rack::File::Iterator)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hanami-controller-2.0.0.alpha8 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha6 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha5 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha4 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha3 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha2 lib/hanami/action/glue.rb
hanami-controller-2.0.0.alpha1 lib/hanami/action/glue.rb