Module: TurboBoost::Commands

Defined in:
lib/turbo_boost/commands/version.rb,
lib/turbo_boost/commands/http_status_codes.rb,
lib/turbo_boost/commands/errors.rb,
lib/turbo_boost/commands/engine.rb

Defined Under Namespace

Modules: ApplicationHelper, AttributeHydration, CommandCallbacks, Controller, Patches Classes: AbortError, AttributeSet, Command, CommandError, ControllerPack, Engine, InvalidClassError, InvalidElementError, InvalidMethodError, InvalidTokenError, Middleware, PerformError, Runner, Sanitizer, State

Constant Summary collapse

VERSION =
"0.2.0"
HTTP_ABORT_STATUS_CODE =

I-285 is the most congested highway in the US (traffic jams → halt/abort)

285
HTTP_STATUS_CODES =
Rack::Utils::HTTP_STATUS_CODES.merge(
  HTTP_ABORT_STATUS_CODE => "Abort TurboBoost Command"
).freeze

Class Method Summary collapse

Class Method Details

.configObject



17
18
19
# File 'lib/turbo_boost/commands/engine.rb', line 17

def self.config
  Rails.application.config.turbo_boost_commands
end

.http_status_code(value) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/turbo_boost/commands/http_status_codes.rb', line 10

def self.http_status_code(value)
  return value.to_i unless value.is_a?(String) || value.is_a?(Symbol)
  return value.to_i if value.match?(/\A\d+\z/)

  case value.to_sym
  when :abort_turbo_boost_command then HTTP_ABORT_STATUS_CODE
  else Rack::Utils::SYMBOL_TO_STATUS_CODE[value.to_sym]
  end
end