0llirocks / cvss-suite

CvssSuite - This Ruby gem helps you to process the vector of the Common Vulnerability Scoring System.
https://cvss-suite.0lli.rocks
Other
23 stars 15 forks source link

String.truncate method in Rails gets polluted when using new gem #39

Closed brphelps closed 3 months ago

brphelps commented 3 months ago

Subject of the issue

When using newer versions of the gem, rails' String.truncate method is overwritten on strings. Where you used to be able to do: some_tring.truncate(1, omission: "...") there is now failures because of the extension in https://github.com/0llirocks/cvss-suite/blob/master/lib/cvss_suite/extensions/string.rb

Your environment

Steps to reproduce

Use the gem in a Rails environment and note that the gem's String.truncate method overwrites Rails'.

Expected behaviour

This gem shouldn't have any impact on framework methods.

Actual behaviour

ArgumentError: wrong number of arguments (given 2, expected 1)
from /localcache/vendor/gem/ruby/3.3.0/gems/cvss-suite-3.2.0/lib/cvss_suite/extensions/string.rb:3:in `truncate'
0llirocks commented 3 months ago

@brphelps Sorry for this issue, didn't really think about it. Will be fixed in 3.2.1. Thanks for reporting and fixing!