From 7ae055c4f1b05c96b2310f74422dfda1457e3867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Thu, 17 Oct 2024 14:46:11 -0700 Subject: [PATCH] Use each_with_object instead of each.with_object --- lib/sass/compiler/host/protofier.rb | 2 +- lib/sass/serializer.rb | 2 +- lib/sass/value/number/unit.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sass/compiler/host/protofier.rb b/lib/sass/compiler/host/protofier.rb index 219f777..72ec4c3 100644 --- a/lib/sass/compiler/host/protofier.rb +++ b/lib/sass/compiler/host/protofier.rb @@ -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) ) ) diff --git a/lib/sass/serializer.rb b/lib/sass/serializer.rb index 12ae70f..6a3bc98 100644 --- a/lib/sass/serializer.rb +++ b/lib/sass/serializer.rb @@ -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 diff --git a/lib/sass/value/number/unit.rb b/lib/sass/value/number/unit.rb index c3c9096..7d7c776 100644 --- a/lib/sass/value/number/unit.rb +++ b/lib/sass/value/number/unit.rb @@ -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