Skip to content

Commit

Permalink
Use each_with_object instead of each.with_object
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Oct 17, 2024
1 parent 95d4afb commit 7ae055c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/sass/compiler/host/protofier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def to_proto(obj)
argument_list: EmbeddedProtocol::Value::ArgumentList.new(
id: obj.instance_eval { @id },
contents: obj.to_a.map { |element| to_proto(element) },
keywords: obj.keywords.each.with_object({}) { |(key, value), hash| hash[key.to_s] = to_proto(value) },
keywords: obj.keywords.each_with_object({}) { |(key, value), hash| hash[key.to_s] = to_proto(value) },
separator: ListSeparator.to_proto(obj.separator)
)
)
Expand Down
2 changes: 1 addition & 1 deletion lib/sass/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Serializer

CSS_ESCAPE = [*"\x01".."\x08", *"\x0A".."\x1F", "\x7F"]
.product([*'0'..'9', *'a'..'f', *'A'..'F', "\t", ' ', nil])
.each.with_object({ "\0" => "\uFFFD", '\\' => '\\\\', '"' => '\\"', "'" => "\\'" }) do |(c, x), h|
.each_with_object({ "\0" => "\uFFFD", '\\' => '\\\\', '"' => '\\"', "'" => "\\'" }) do |(c, x), h|
h["#{c}#{x}".freeze] = "\\#{c.ord.to_s(16)}#{" #{x}" if x}".freeze
end.freeze

Expand Down
2 changes: 1 addition & 1 deletion lib/sass/value/number/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ module Unit
'pixel density': %w[dpi dpcm dppx]
}.freeze

TYPES_BY_UNIT = UNITS_BY_TYPE.each.with_object({}) do |(key, values), hash|
TYPES_BY_UNIT = UNITS_BY_TYPE.each_with_object({}) do |(key, values), hash|
values.each do |value|
hash[value] = key
end
Expand Down

0 comments on commit 7ae055c

Please sign in to comment.