Module: SwaggerShield

Defined in:
lib/swagger_shield.rb,
lib/swagger_shield/shield.rb,
lib/swagger_shield/version.rb,
lib/swagger_shield/before_action.rb

Defined Under Namespace

Classes: BeforeAction, Shield

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.protect!(controller, swagger_file:, **opts) ⇒ Object



8
9
10
11
12
13
# File 'lib/swagger_shield.rb', line 8

def protect!(controller, swagger_file:, **opts)
  shield = SwaggerShield::Shield.new(
    YAML.load_file(swagger_file)
  )
  controller.before_action SwaggerShield::BeforeAction.new(shield), **opts
end