Class: GraphqlDevise::MountMethod::OperationSanitizer
- Inherits:
-
Object
- Object
- GraphqlDevise::MountMethod::OperationSanitizer
- Defined in:
- lib/graphql_devise/mount_method/operation_sanitizer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(default:, only:, skipped:) ⇒ OperationSanitizer
constructor
A new instance of OperationSanitizer.
Constructor Details
#initialize(default:, only:, skipped:) ⇒ OperationSanitizer
Returns a new instance of OperationSanitizer.
14 15 16 17 18 |
# File 'lib/graphql_devise/mount_method/operation_sanitizer.rb', line 14 def initialize(default:, only:, skipped:) @default = default @only = only @skipped = skipped end |
Class Method Details
.call(default:, only:, skipped:) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/graphql_devise/mount_method/operation_sanitizer.rb', line 6 def self.call(default:, only:, skipped:) new( default: default, only: only, skipped: skipped ).call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/graphql_devise/mount_method/operation_sanitizer.rb', line 20 def call operations = if @only.present? @default.slice(*@only) elsif @skipped.present? @default.except(*@skipped) else @default end end |