Sha256: 25c3944114e894e38fcf5449597649a77b2e2e63dd3224a62a2a7664149cc8f3

Contents?: true

Size: 657 Bytes

Versions: 11

Compression:

Stored size: 657 Bytes

Contents

class Grape::App::Configuration < ActiveSupport::InheritableOptions
  def middleware(&block)
    self[:middleware] ||= []
    self[:middleware].push(block) if block
    super
  end

  def cors(&block)
    self.cors = block if block
    super
  end

  def cors_allow_origins=(value)
    warn "[DEPRECATION] setting `config.cors_allow_origins` is deprecated. Please use `config.cors` with a block instead. [#{caller(1..1).first}]"

    value = Array.wrap(value)
    cors do
      allow do
        origins *value # rubocop:disable Lint/AmbiguousOperator
        resource '*', headers: :any, methods: %i[get post options delete put]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
grape-app-0.11.3 lib/grape/app/configuration.rb
grape-app-0.11.2 lib/grape/app/configuration.rb
grape-app-0.11.1 lib/grape/app/configuration.rb
grape-app-0.11.0 lib/grape/app/configuration.rb
grape-app-0.10.1 lib/grape/app/configuration.rb
grape-app-0.10.0 lib/grape/app/configuration.rb
grape-app-0.9.0 lib/grape/app/configuration.rb
grape-app-0.8.8 lib/grape/app/configuration.rb
grape-app-0.8.7 lib/grape/app/configuration.rb
grape-app-0.8.6 lib/grape/app/configuration.rb
grape-app-0.8.5 lib/grape/app/configuration.rb