Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/css_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ module CssParser
# TODO: declaration_hashes should be able to contain a RuleSet
# this should be a Class method
def self.merge(*rule_sets)
@folded_declaration_cache = {}
Copy link
Contributor Author

@sokolikp sokolikp Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was setting @folded_declaration_cache on the CssParser module object itself — completely separate from both the class-level one on Parser and the per-instance one created in reset!. Three different Ruby objects all had an ivar with the same name, but nothing ever read from this one.


# in case called like CssParser.merge([rule_set, rule_set])
rule_sets.flatten! if rule_sets[0].is_a?(Array)

Expand Down
6 changes: 0 additions & 6 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ class Parser
# Array of CSS files that have been loaded.
attr_reader :loaded_uris

#--
# Class variable? see http://www.oreillynet.com/ruby/blog/2007/01/nubygems_dont_use_class_variab_1.html
#++
@folded_declaration_cache = {}
class << self; attr_reader :folded_declaration_cache; end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class-level @folded_declaration_cache and its accessor were dead code. Nothing ever reads Parser.folded_declaration_cache (the class method). All actual usage (lines 693, 698, 702) references @folded_declaration_cache on self — the instance. The reset! method (called from initialize) creates a fresh per-instance @folded_declaration_cache = {} that shadows the class-level one. So the class-level hash just accumulated stale data forever with nothing reading it. Same story for the @folded_declaration_cache = {} reset in CssParser.merge — it was setting it on the CssParser module object, which nothing ever reads.


def initialize(options = {})
@options = {
absolute_paths: false,
Expand Down
Loading