-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix Gem::Specification#to_ruby without OpenSSL #3059
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -2414,7 +2414,10 @@ def test_files # :nodoc: | |||||||
| # still have their default values are omitted. | ||||||||
|
|
||||||||
| def to_ruby | ||||||||
| require 'openssl' | ||||||||
| begin | ||||||||
| require 'openssl' | ||||||||
| rescue LoadError | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| end | ||||||||
| mark_version | ||||||||
| result = [] | ||||||||
| result << "# -*- encoding: utf-8 -*-" | ||||||||
|
|
@@ -2454,7 +2457,9 @@ def to_ruby | |||||||
| next if handled.include? attr_name | ||||||||
| current_value = self.send(attr_name) | ||||||||
| if current_value != default_value(attr_name) || self.class.required_attribute?(attr_name) | ||||||||
| result << " s.#{attr_name} = #{ruby_code current_value}" unless current_value.is_a?(OpenSSL::PKey::RSA) | ||||||||
| unless defined?(OpenSSL) && current_value.is_a?(OpenSSL::PKey::RSA) | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this approach
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i prefer keeping consistent with the library by checking for the constant |
||||||||
| result << " s.#{attr_name} = #{ruby_code current_value}" | ||||||||
| end | ||||||||
| end | ||||||||
| end | ||||||||
|
|
||||||||
|
|
||||||||
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.