-
-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #566 from onelogin/1.12.0-dev
1.12.0 branch
- Loading branch information
Showing
36 changed files
with
832 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,29 @@ def ==(other) | |
end | ||
end | ||
|
||
# Fetch attribute value using name or regex | ||
# @param name [String|Regexp] The attribute name | ||
# @return [String|Array] Depending on the single value compatibility status this returns: | ||
# - First value if single_value_compatibility = true | ||
# response.attributes['mail'] # => '[email protected]' | ||
# - All values if single_value_compatibility = false | ||
# response.attributes['mail'] # => ['[email protected]','[email protected]'] | ||
# | ||
def fetch(name) | ||
attributes.each_key do |attribute_key| | ||
if name.is_a?(Regexp) | ||
if name.method_exists? :match? | ||
return self[attribute_key] if name.match?(attribute_key) | ||
else | ||
return self[attribute_key] if name.match(attribute_key) | ||
end | ||
elsif canonize_name(name) == canonize_name(attribute_key) | ||
return self[attribute_key] | ||
end | ||
end | ||
nil | ||
end | ||
|
||
protected | ||
|
||
# stringifies all names so both 'email' and :email return the same result | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.