Sha256: 7c7a8e513b8f2dae121e493ddee70bbe5e6ed434b80fbb0aa921134b847fd153

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

module Modern
  # rubocop:disable Lint/InheritException
  class Redirect < Exception
    attr_reader :redirect_to

    def initialize(redirect_to)
      raise "Redirects require a target." if redirect_to.nil?
      @redirect_to = redirect_to
    end

    def status
      raise "#{self.class.name}#status must be implemented."
    end
  end
  # rubocop:enable Lint/InheritException

  class PermanentRedirect < Redirect
    def status
      308
    end
  end

  class TemporaryRedirect < Redirect
    def status
      307
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
modern-0.5.0 lib/modern/redirect.rb
modern-0.4.6 lib/modern/redirect.rb
modern-0.4.5 lib/modern/redirect.rb
modern-0.4.4 lib/modern/redirect.rb
modern-0.4.3 lib/modern/redirect.rb
modern-0.4.2 lib/modern/redirect.rb