Skip to content

Commit a496587

Browse files
committed
change nil checks to check if proc/lambda
1 parent 6e7efda commit a496587

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/controllers/scim_rails/scim_resource_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module ScimRails
22
class ScimResourceController < ScimRails::ApplicationController
33
def resource_user
4-
ScimRails.config.before_scim_response.call(request.params) unless ScimRails.config.before_scim_response.nil?
4+
ScimRails.config.before_scim_response.call(request.params) if ScimRails.config.before_scim_response.respond_to?(:call)
55

6-
ScimRails.config.after_scim_response.call(ScimRails.config.resource_user_schema, "RETRIEVED") unless ScimRails.config.after_scim_response.nil?
6+
ScimRails.config.after_scim_response.call(ScimRails.config.resource_user_schema, "RETRIEVED") if ScimRails.config.after_scim_response.respond_to?(:call)
77

88
json_scim_response(object: nil)
99
end
1010

1111
def resource_group
12-
ScimRails.config.before_scim_response.call(request.params) unless ScimRails.config.before_scim_response.nil?
12+
ScimRails.config.before_scim_response.call(request.params) if ScimRails.config.before_scim_response.respond_to?(:call)
1313

14-
ScimRails.config.after_scim_response.call(ScimRails.config.resource_group_schema, "RETRIEVED") unless ScimRails.config.after_scim_response.nil?
14+
ScimRails.config.after_scim_response.call(ScimRails.config.resource_group_schema, "RETRIEVED") if ScimRails.config.after_scim_response.respond_to?(:call)
1515

1616
json_scim_response(object: nil)
1717
end

app/controllers/scim_rails/scim_schema_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module ScimRails
22
class ScimSchemaController < ApplicationController
33
def get_schema
4-
ScimRails.config.before_scim_response.call(request.params) unless ScimRails.config.before_scim_response.nil?
4+
ScimRails.config.before_scim_response.call(request.params) if ScimRails.config.before_scim_response.respond_to?(:call)
55

66
id = request.params.key?("format") ? "#{request.params[:id]}.#{request.params[:format]}" : request.params[:id]
77

@@ -13,7 +13,7 @@ def get_schema
1313
object = {}
1414
end
1515

16-
ScimRails.config.after_scim_response.call(object, "RETRIEVED") unless ScimRails.config.after_scim_response.nil?
16+
ScimRails.config.after_scim_response.call(object, "RETRIEVED") if ScimRails.config.after_scim_response.respond_to?(:call)
1717

1818
json_schema_response(object)
1919
end

0 commit comments

Comments
 (0)