facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
210 stars 160 forks source link

Not compatible with `frozen_string_literal: true` #22

Closed stex closed 4 years ago

stex commented 7 years ago

The gem in its current form is not compatible with frozen string literals as destructive methods like gsub! are used.

Here is an example:

# frozen_string_literal: true
FacebookAds::AdAccount.get('act_12345', 'name)

#=> RuntimeError: can't modify frozen String
#=> from .../gems/facebookads-0.2.10.0/lib/facebook_ads/session.rb:39:in `gsub!'

Immutable string literals will be the default in ruby 3, so it might be a good idea to already stop using destructive string methods.

Edit: It gets better as of course things like the following won't work either, as the result is already immutable without any additional magic comment:

FacebookAds::AdAccount.get(ENV['FB_AD_ACCOUNT_ID'], 'name)

It's generally bad practice to mutate an input parameter like this.

stale[bot] commented 4 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.