-
-
Notifications
You must be signed in to change notification settings - Fork 591
[WIP] v2.x - Nokogiri Refactor Part 6 - Conversion of SignedDocument and final removal of REXML 🎉 #759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pitbulk
merged 8 commits into
SAML-Toolkits:v2.x
from
johnnyshields:signed-document-info-refactor
Nov 20, 2025
+890
−953
Merged
[WIP] v2.x - Nokogiri Refactor Part 6 - Conversion of SignedDocument and final removal of REXML 🎉 #759
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ae09439
Refactor to use SignedDocumentInfo. Remove REXML entirely in favor of…
johnnyshields 3b16870
Update README.md
johnnyshields 2ed7183
Merge remote-tracking branch 'remotes/johnnyshields/v2.x-decryption-r…
johnnyshields 04a7b8e
Merge remote-tracking branch 'remotes/origin/v2.x' into signed-docume…
johnnyshields 591bdaa
Change deprecations to be removed in RubySaml 3.0.0, for SemVer reasons
johnnyshields 0b0799b
Merge branch 'v2.x' into signed-document-info-refactor
johnnyshields a7dba95
Update UPGRADING.md for REXML to Nokogiri changes
johnnyshields ba37e1f
Update add_extras in readme
johnnyshields File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module RubySaml | ||
| # Mixin for memoizing methods | ||
| module Memoizable | ||
| # Creates a memoized method | ||
| # | ||
| # @param method_name [Symbol] the name of the method to memoize | ||
| # @param original_method [Symbol, nil] the original method to memoize (defaults to method_name) | ||
| def self.included(base) | ||
| base.extend(ClassMethods) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| # Memoizes the result of a block using the given name as the cache key | ||
| # | ||
| # @param cache_key [Symbol, String] the name to use as the cache key | ||
| # @yield the block whose result will be cached | ||
| # @return [Object] the cached result or the result of the block | ||
| def memoize(cache_key) | ||
| cache_key = "@#{cache_key.to_s.delete_prefix('@')}" | ||
| return instance_variable_get(cache_key) if instance_variable_defined?(cache_key) | ||
|
|
||
| instance_variable_set(cache_key, yield) | ||
| end | ||
|
|
||
| # Class methods for memoization | ||
| module ClassMethods | ||
| # Defines multiple memoized methods | ||
| # | ||
| # @param method_names [Array<Symbol>] the names of the methods to memoize | ||
| # @raise [ArgumentError] if any method has an arity greater than 0 | ||
| def memoize_method(*method_names) | ||
| method_names.each do |method_name| | ||
| method_obj = instance_method(method_name) | ||
|
|
||
| # Check method arity | ||
| if method_obj.arity > 0 # rubocop:disable Style/IfUnlessModifier | ||
| raise ArgumentError.new("Cannot memoize method '#{method_name}' with arity > 0") | ||
| end | ||
|
|
||
| # Store the original method | ||
| original_method_name = "#{method_name}_without_memoization" | ||
| alias_method original_method_name, method_name | ||
| private original_method_name | ||
|
|
||
| # Define the memoized version | ||
| define_method(method_name) do |&block| | ||
| cache_key = "@memoized_#{method_name}" | ||
| memoize(cache_key) do | ||
| send(original_method_name, &block) | ||
| end | ||
| end | ||
|
|
||
| # Preserve method visibility | ||
| if private_method_defined?(original_method_name) | ||
| private method_name | ||
| elsif protected_method_defined?(original_method_name) | ||
| protected method_name | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
including