Skip to content

Commit 8e33c3c

Browse files
committed
Add "# frozen_string_literal: true" to the beggining of ruby files.
This is make string literals immutable which is increase speed and make code a bit more thread safe. This feature has been introduced in Ruby 2.3.0.
1 parent 4bec17c commit 8e33c3c

21 files changed

+40
-0
lines changed

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
# Specify your dependencies in com-common.gemspec

Rakefile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "bundler/gem_tasks"
24
require "rspec/core/rake_task"
35

bin/console

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require "bundler/setup"
45
require "com"

com-common.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
lib = File.expand_path("../lib", __FILE__)
24
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
35

exe/com-common

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require "com"

lib/com-common.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
require "com"

lib/com.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Namespace for Com set of libraries.
24
#
35
# Purpose: namespace

lib/com/abstract_method_error.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Represents errors related to "abstract" methods.
24
#
35
# Despite Ruby does not have

lib/com/common.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "com/common/version"
24

35

lib/com/common/error.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Purpose: mixin
24
#
35
# @see ::Com::Error

lib/com/common/version.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# GOTCHA: this file is an exclusion from rule or plain module definition, because
24
# it is used in com-common.gemspec file where all root namespaces
35
# do not loaded. So, they have to be defined hierarchically.

lib/com/error.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Purpose: mixin
24
#
35
# This module should be mixed into all exceptions of ::RuntimeError type.

lib/com/standard_error.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Purpose: mixin
24
#
35
# This module should be mixed into all exceptions of ::StandardError type.

spec/com-common_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
24

35

spec/lib/com/abstract_method_error_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com::AbstractMethodError do
24
describe ".method_not_overridden_error" do
35
let(:klass) { SomeArbitraryClass }

spec/lib/com/common/error_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com::Common::Error do
24
it { expect(described_class).to include(::Com::Error) }
35
end

spec/lib/com/common_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com::Common do
24
it "has a version number" do
35
expect(::Com::Common::VERSION).not_to be nil

spec/lib/com/error_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com::Error do
24
end

spec/lib/com/standard_error_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com::StandardError do
24
end

spec/lib/com_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
::RSpec.describe ::Com do
24
end

spec/spec_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# This file was generated by the `rspec --init` command. Conventionally, all
24
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
35
# The generated `.rspec` file contains `--require spec_helper` which will cause

0 commit comments

Comments
 (0)