rgrove / crass

A Ruby CSS parser that's fully compliant with the CSS Syntax Level 3 specification.
MIT License
138 stars 14 forks source link

Support frozen string literals #3

Closed flavorjones closed 6 years ago

flavorjones commented 6 years ago

Related to https://github.com/flavorjones/loofah/issues/118, I'd like to ensure that Loofah supports Ruby's "frozen string literals" option.

Essentially this PR turns instances of '' which are mutated into a call to String.new, which returns mutable strings. All changes were driven by failing tests when this option is set.

rgrove commented 6 years ago

@flavorjones Thanks! Looks like tests are failing in older Rubies due to the unknown --enable-frozen-string-literal option though:

$ bundle exec rake
NOTE: Testing support for frozen string literals
/home/travis/.rvm/rubies/ruby-2.2.2/bin/ruby: warning: unknown argument for --enable: `frozen-string-literal'
/home/travis/.rvm/rubies/ruby-2.2.2/bin/ruby: invalid option --debug=frozen-string-literal  (-h will show valid options) (RuntimeError)
rake aborted!
flavorjones commented 6 years ago

Ugh! Sorry about that. Fix coming ...

flavorjones commented 6 years ago

All green!

flavorjones commented 6 years ago

No, sorry, I messed that up. Hang on. Case of the mondays.

rgrove commented 6 years ago

@flavorjones Looks like tests are passing now, thanks! Is this ready to merge or should I continue hanging on?

flavorjones commented 6 years ago

I think you can :shipit: !