matthewrudy / memoist

ActiveSupport::Memoizable with a few enhancements
MIT License
920 stars 99 forks source link

Fix regression introduced by frozen symbol fix #86

Closed sebjacobs closed 4 years ago

sebjacobs commented 4 years ago

There was a recent change [1] made to how punctuation is escaped to address an issue introduced by a proposal in Ruby 2.7 (which is to change the behaviour of Symbol#to_s so that it returns a frozen string) [2].

This ended up breaking support for calling the memoize method with a punctuated string [3], e.g.

class Dog
  extend Memoist

  def woof?
    true
  end

  memoize 'woof?'
end

I have added an additional test which should prevent further regressions from being introduced.

[1] a893ce6 [2] https://bugs.ruby-lang.org/issues/16150 [3] https://github.com/matthewrudy/memoist/issues/85