Module: Hanami::Action::Glue Private

Defined in:
lib/hanami/action/glue.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Glue code for full stack Hanami applications

This includes missing rendering logic that it makes sense to include only for web applications.

Since:

  • 0.3.0

Constant Summary collapse

ENV_KEY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Rack environment key that indicates where the action instance is passed

Since:

  • 0.3.0

'hanami.action'.freeze
ADDITIONAL_HTTP_STATUSES_WITHOUT_BODY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.3.2

Set.new([301, 302]).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Override Ruby's Module#included

Since:

  • 0.3.0


25
26
27
# File 'lib/hanami/action/glue.rb', line 25

def self.included(base)
  base.class_eval { _expose(:format) if respond_to?(:_expose) }
end

Instance Method Details

#renderable?TrueClass, FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check if the current HTTP request is renderable.

It verifies if the verb isn't HEAD, if the status demands to omit the body and if it isn't sending a file.

Returns:

  • (TrueClass, FalseClass)

    the result of the check

Since:

  • 0.3.2


38
39
40
41
42
# File 'lib/hanami/action/glue.rb', line 38

def renderable?
  !_requires_no_body? &&
    !sending_file?    &&
    !ADDITIONAL_HTTP_STATUSES_WITHOUT_BODY.include?(@_status)
end