From 35fee91c461f34c7f2cae20591cbc2d266a587b7 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 26 Apr 2024 22:58:28 +0200 Subject: [PATCH] Standard --- lib/stimulus_reflex/dataset.rb | 2 +- lib/stimulus_reflex/element.rb | 2 +- lib/stimulus_reflex/installer.rb | 6 +++--- test/configuration_test.rb | 2 +- test/html/document_fragment_test.rb | 5 ++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/stimulus_reflex/dataset.rb b/lib/stimulus_reflex/dataset.rb index e695cd3f..f29209aa 100644 --- a/lib/stimulus_reflex/dataset.rb +++ b/lib/stimulus_reflex/dataset.rb @@ -13,7 +13,7 @@ def initialize(data = {}) @attrs = build_data_attrs(regular_dataset, datasets["datasetAll"] || {}) @data_attrs = @attrs.transform_keys { |key| key.delete_prefix "data-" } - super build_underscored(@data_attrs) + super(build_underscored(@data_attrs)) end def signed diff --git a/lib/stimulus_reflex/element.rb b/lib/stimulus_reflex/element.rb index 5b9bd3f5..63777aa5 100644 --- a/lib/stimulus_reflex/element.rb +++ b/lib/stimulus_reflex/element.rb @@ -17,7 +17,7 @@ def initialize(data = {}) @dataset = StimulusReflex::Dataset.new(data) all_attributes = @attrs.merge(@dataset.attrs) - super build_underscored(all_attributes) + super(build_underscored(all_attributes)) end def attributes diff --git a/lib/stimulus_reflex/installer.rb b/lib/stimulus_reflex/installer.rb index 72eda879..df15625c 100644 --- a/lib/stimulus_reflex/installer.rb +++ b/lib/stimulus_reflex/installer.rb @@ -13,9 +13,9 @@ def complete_step(step) create_file "tmp/stimulus_reflex_installer/#{step}", verbose: false end -def create_or_append(path, *args, &block) +def create_or_append(path, *, &) FileUtils.touch(path) - append_file(path, *args, &block) + append_file(path, *, &) end def current_template @@ -303,7 +303,7 @@ def options_path end def options - @options ||= YAML.safe_load(File.read(options_path)) + @options ||= YAML.safe_load_file(options_path) end def working diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 780be574..30328bfc 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -7,7 +7,7 @@ def revert_config_changes(key) yield - StimulusReflex.config.send("#{key}=", previous_value) + StimulusReflex.config.send(:"#{key}=", previous_value) end class MyLogger diff --git a/test/html/document_fragment_test.rb b/test/html/document_fragment_test.rb index 15aab8ff..9e3c466a 100644 --- a/test/html/document_fragment_test.rb +++ b/test/html/document_fragment_test.rb @@ -35,7 +35,6 @@ class StimulusReflex::HTML::DocumentFragmentTest < ActiveSupport::TestCase assert_nil fragment.match("body").inner_html end - test "should handle string" do fragment = StimulusReflex::HTML::DocumentFragment.new("Some String") @@ -267,8 +266,8 @@ class StimulusReflex::HTML::DocumentFragmentTest < ActiveSupport::TestCase ) fragment = StimulusReflex::HTML::DocumentFragment.new(html) - assert_equal %(
After Input
), fragment.to_html.squish - assert_equal %(
After Input
), fragment.outer_html.squish + assert_equal %(
After Input
), fragment.to_html.squish + assert_equal %(
After Input
), fragment.outer_html.squish end test "non-closing tag with -> in attribute" do