Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Gem provides a Ruby interface to [the Pusher HTTP API for Pusher Channels](

## Supported Platforms

* Ruby - supports **Ruby 2.6 or greater**.
* Ruby - supports **Ruby 3.1 or greater**.

## Installation and Configuration

Expand Down
2 changes: 1 addition & 1 deletion lib/pusher/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Channel
INVALID_CHANNEL_REGEX = /[^A-Za-z0-9_\-=@,.;]/

def initialize(_, name, client = Pusher)
if Pusher::Channel::INVALID_CHANNEL_REGEX.match(name)
if Pusher::Channel::INVALID_CHANNEL_REGEX.match?(name)
raise Pusher::Error, "Illegal channel name '#{name}'"
elsif name.length > 200
raise Pusher::Error, "Channel name too long (limit 164 characters) '#{name}'"
Expand Down
6 changes: 3 additions & 3 deletions lib/pusher/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def trigger_batch_async(*events)
def authenticate(channel_name, socket_id, custom_data = nil)
channel_instance = channel(channel_name)
r = channel_instance.authenticate(socket_id, custom_data)
if channel_name.match(/^private-encrypted-/)
if channel_name.match?(/^private-encrypted-/)
r[:shared_secret] = Base64.strict_encode64(
channel_instance.shared_secret(encryption_master_key)
)
Expand Down Expand Up @@ -430,7 +430,7 @@ def trigger_params(channels, event_name, data, params)
channels = Array(channels).map(&:to_s)
raise Pusher::Error, "Too many channels (#{channels.length}), max 100" if channels.length > 100

encoded_data = if channels.any?{ |c| c.match(/^private-encrypted-/) } then
encoded_data = if channels.any?{ |c| c.match?(/^private-encrypted-/) }
raise Pusher::Error, "Cannot trigger to multiple channels if any are encrypted" if channels.length > 1
encrypt(channels[0], encode_data(data))
else
Expand All @@ -448,7 +448,7 @@ def trigger_batch_params(events)
{
batch: events.map do |event|
event.dup.tap do |e|
e[:data] = if e[:channel].match(/^private-encrypted-/) then
e[:data] = if e[:channel].match?(/^private-encrypted-/)
encrypt(e[:channel], encode_data(e[:data]))
else
encode_data(e[:data])
Expand Down
2 changes: 1 addition & 1 deletion lib/pusher/utils.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Pusher
module Utils
def validate_socket_id(socket_id)
unless socket_id && /\A\d+\.\d+\z/.match(socket_id)
unless socket_id && /\A\d+\.\d+\z/.match?(socket_id)
raise Pusher::Error, "Invalid socket ID #{socket_id.inspect}"
end
end
Expand Down