Skip to content

Commit

Permalink
Freeze mutable objects assigned to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jan 19, 2016
1 parent 2b45ccb commit c9e16e0
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require 'bundler'
Bundler::GemHelper.install_tasks

task :erd do
FORMAT = 'svg'
FORMAT = 'svg'.freeze
`bundle exec ruby ./etc/erd.rb > ./etc/erd.dot`
`dot -T #{FORMAT} ./etc/erd.dot -o ./etc/erd.#{FORMAT}`
end
Expand Down
8 changes: 4 additions & 4 deletions etc/erd.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'twitter'

COLON = ':'
UNDERSCORE = '_'
TAB = "\t"
NAMESPACE = 'Twitter::'
COLON = ':'.freeze
UNDERSCORE = '_'.freeze
TAB = "\t".freeze
NAMESPACE = 'Twitter::'.freeze

# Colons are invalid characters in DOT nodes.
# Replace them with underscores.
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Twitter
module REST
class Client < Twitter::Client
include Twitter::REST::API
BASE_URL = 'https://api.twitter.com'
BASE_URL = 'https://api.twitter.com'.freeze
URL_PREFIX = BASE_URL
ENDPOINT = BASE_URL
attr_accessor :bearer_token
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Lists
include Twitter::REST::Utils
include Twitter::Utils
MAX_USERS_PER_REQUEST = 100
URI_SUBSTRING = '://'
URI_SUBSTRING = '://'.freeze

# Returns all lists the authenticating or specified user subscribes to, including their own
#
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/request/multipart_with_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Twitter
module REST
class Request
class MultipartWithFile < Faraday::Middleware
CONTENT_TYPE = 'Content-Type'
CONTENT_TYPE = 'Content-Type'.freeze
BMP_REGEX = /\.bmp/i
GIF_REGEX = /\.gif$/i
JPEG_REGEX = /\.jpe?g/i
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Twitter
module REST
module Utils
include Twitter::Utils
URI_SUBSTRING = '://'
URI_SUBSTRING = '://'.freeze
DEFAULT_CURSOR = -1

private
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/streaming/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ class Event
:list_created, :list_destroyed, :list_updated, :list_member_added,
:list_member_added, :list_member_removed, :list_user_subscribed,
:list_user_subscribed, :list_user_unsubscribed, :list_user_unsubscribed
]
].freeze

TWEET_EVENTS = [
:favorite, :unfavorite
]
].freeze

attr_reader :name, :source, :target, :target_object

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Token < Twitter::Base
attr_reader :access_token, :token_type
alias to_s access_token

BEARER_TYPE = 'bearer'
BEARER_TYPE = 'bearer'.freeze

# @return [Boolean]
def bearer?
Expand Down

0 comments on commit c9e16e0

Please sign in to comment.