Skip to content

Commit

Permalink
[rubocop] frozen strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Aug 9, 2017
1 parent a890178 commit 896b037
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ Metrics/BlockLength:
- 'Rakefile'
- '**/*.rake'
- 'spec/**/*_spec.rb'

Style/FrozenStringLiteralComment:
Enabled: true
Exclude:
- 'spec/**/*.rb'
2 changes: 2 additions & 0 deletions lib/message_bus_client.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'excon'
require 'json'
require 'securerandom'
Expand Down
2 changes: 2 additions & 0 deletions lib/message_bus_client/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module MessageBusClient::Configuration
def self.included(module_)
module_.extend(ClassMethods)
Expand Down
6 changes: 4 additions & 2 deletions lib/message_bus_client/connection.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module MessageBusClient::Connection
# The connection is in the initialised state.
INITIALISED = 0
Expand Down Expand Up @@ -105,10 +107,10 @@ def headers

# Gets the URI to poll the server with
def server_endpoint
endpoint = "#{@base_url}/message-bus/#{@client_id}/poll"
endpoint = +"#{@base_url}/message-bus/#{@client_id}/poll"
endpoint << '?dlp=t' unless self.class.long_polling

endpoint
endpoint.freeze
end

# Handles the response from the connection.
Expand Down
6 changes: 4 additions & 2 deletions lib/message_bus_client/message_handler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module MessageBusClient::MessageHandler
SubscribedChannel = Struct.new(:callbacks, :last_id) do
def initialize(last_id = -1)
Expand All @@ -13,7 +15,7 @@ def callback(payload)
end

# The chunk separator for chunked messages.
CHUNK_SEPARATOR = "\r\n|\r\n".freeze
CHUNK_SEPARATOR = "\r\n|\r\n"

def initialize(base_url)
super
Expand All @@ -23,7 +25,7 @@ def initialize(base_url)
@subscribed_channels.default_proc = proc do |hash, key|
hash[key] = SubscribedChannel.new
end
@payload = ''
@payload = +''
end

def subscribe(channel, &callback)
Expand Down
4 changes: 3 additions & 1 deletion lib/message_bus_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class MessageBusClient
VERSION = '0.2.0'.freeze
VERSION = '0.2.0'
end

0 comments on commit 896b037

Please sign in to comment.