From ee21c0bf299010a771a9884a466311b9f46451fd Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 2 Jul 2017 19:26:00 -0400 Subject: [PATCH] Add frozen_string_literal to subscriber files" --- lib/docs/core/subscriber.rb | 3 +++ lib/docs/subscribers/doc_subscriber.rb | 2 ++ lib/docs/subscribers/filter_subscriber.rb | 2 ++ lib/docs/subscribers/progress_bar_subscriber.rb | 2 ++ lib/docs/subscribers/request_subscriber.rb | 2 ++ lib/docs/subscribers/scraper_subscriber.rb | 4 +++- lib/docs/subscribers/store_subscriber.rb | 2 ++ 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/docs/core/subscriber.rb b/lib/docs/core/subscriber.rb index e1fb4e45..b30d273d 100644 --- a/lib/docs/core/subscriber.rb +++ b/lib/docs/core/subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'active_support/subscriber' module Docs @@ -26,6 +28,7 @@ module Docs def justify(str) return str unless terminal_width + str = str.dup max_length = if tag = str.slice!(/ \[.+\]\z/) terminal_width - tag.length diff --git a/lib/docs/subscribers/doc_subscriber.rb b/lib/docs/subscribers/doc_subscriber.rb index 18ad591d..d3f0ae3d 100644 --- a/lib/docs/subscribers/doc_subscriber.rb +++ b/lib/docs/subscribers/doc_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class DocSubscriber < Subscriber self.namespace = 'doc' diff --git a/lib/docs/subscribers/filter_subscriber.rb b/lib/docs/subscribers/filter_subscriber.rb index a9bf0d96..b3da1dff 100644 --- a/lib/docs/subscribers/filter_subscriber.rb +++ b/lib/docs/subscribers/filter_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class FilterSubscriber < Subscriber self.namespace = 'html_pipeline' diff --git a/lib/docs/subscribers/progress_bar_subscriber.rb b/lib/docs/subscribers/progress_bar_subscriber.rb index c1b7488c..b7e5f727 100644 --- a/lib/docs/subscribers/progress_bar_subscriber.rb +++ b/lib/docs/subscribers/progress_bar_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'progress_bar' module Docs diff --git a/lib/docs/subscribers/request_subscriber.rb b/lib/docs/subscribers/request_subscriber.rb index afd4c18c..246a15b9 100644 --- a/lib/docs/subscribers/request_subscriber.rb +++ b/lib/docs/subscribers/request_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class RequestSubscriber < Subscriber self.namespace = 'request' diff --git a/lib/docs/subscribers/scraper_subscriber.rb b/lib/docs/subscribers/scraper_subscriber.rb index 8eeea881..ca9cc24d 100644 --- a/lib/docs/subscribers/scraper_subscriber.rb +++ b/lib/docs/subscribers/scraper_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class ScraperSubscriber < Subscriber self.namespace = 'scraper' @@ -12,7 +14,7 @@ module Docs def ignore_response(event) msg = "Ignore: #{format_url event.payload[:response].url}" - msg << " [#{event.payload[:response].code}]" if event.payload[:response].respond_to?(:code) + msg += " [#{event.payload[:response].code}]" if event.payload[:response].respond_to?(:code) log(msg) end diff --git a/lib/docs/subscribers/store_subscriber.rb b/lib/docs/subscribers/store_subscriber.rb index d0f55631..4f85cd15 100644 --- a/lib/docs/subscribers/store_subscriber.rb +++ b/lib/docs/subscribers/store_subscriber.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Docs class StoreSubscriber < Subscriber self.namespace = 'store'