Skip to content

Commit

Permalink
feat: compare index by cache_key
Browse files Browse the repository at this point in the history
index_record.index == Config::Index([:remap, :LEFTSHIFT])
  • Loading branch information
iberianpig committed Jan 19, 2024
1 parent dc9f931 commit 7d520a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/fusuma/config/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(keys)
key = Key.new(key) if !key.is_a? Key
@keys << key
key.symbol
end.join(",")
end.join(",").to_sym
else
key = Key.new(keys)
@cache_key = key.symbol
Expand All @@ -26,6 +26,12 @@ def to_s
@keys.map(&:inspect)
end

def ==(other)
return false unless other.is_a? Index

cache_key == other.cache_key
end

attr_reader :keys, :cache_key

# Keys in Index
Expand Down

0 comments on commit 7d520a9

Please sign in to comment.