From c78ffa468dbe096edea27ca88008144b2fb29ef8 Mon Sep 17 00:00:00 2001 From: Adrien Poly <adrienpoly@gmail.com> Date: Wed, 5 Mar 2025 10:46:15 +0100 Subject: [PATCH] fix frozen string literal warnings --- lib/psych/comments/emitter.rb | 9 ++++++--- lib/psych/comments/parsing.rb | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/psych/comments/emitter.rb b/lib/psych/comments/emitter.rb index ac605b8..2a48c10 100644 --- a/lib/psych/comments/emitter.rb +++ b/lib/psych/comments/emitter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Psych module Comments module NodeUtils @@ -64,7 +66,8 @@ module NodeUtils class Emitter include NodeUtils - INDENT = " " + INDENT = " ".freeze + SPACE = " ".freeze DEFAULT_TAGMAP = { '!' => '!', @@ -74,7 +77,7 @@ class Emitter attr_reader :out def initialize - @out = "" + @out = String.new @state = :init @indent = 0 @flow = false @@ -85,7 +88,7 @@ def initialize def print(text) case @state when :word_end - @out << " " + @out << SPACE when :line_start @out << INDENT * @indent end diff --git a/lib/psych/comments/parsing.rb b/lib/psych/comments/parsing.rb index 09d4609..d0c57af 100644 --- a/lib/psych/comments/parsing.rb +++ b/lib/psych/comments/parsing.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Psych module Comments class Analyzer