Skip to content

Commit

Permalink
rubocop -a --only Style/StringLiterals
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Dec 12, 2020
1 parent 1782094 commit 78f36e8
Show file tree
Hide file tree
Showing 33 changed files with 343 additions and 343 deletions.
42 changes: 21 additions & 21 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
source 'https://rubygems.org'
source "https://rubygems.org"

eval_gemfile 'Gemfile.devtools'
eval_gemfile "Gemfile.devtools"

gemspec

if ENV['DRY_TYPES_FROM_MASTER'].eql?('true')
gem 'dry-types', github: 'dry-rb/dry-types', branch: 'master'
if ENV["DRY_TYPES_FROM_MASTER"].eql?("true")
gem "dry-types", github: "dry-rb/dry-types", branch: "master"
else
gem 'dry-types'
gem "dry-types"
end

group :benchmarks do
if RUBY_VERSION < '2.4'
gem 'activesupport', '< 5'
if RUBY_VERSION < "2.4"
gem "activesupport", "< 5"
else
gem 'activesupport'
gem "activesupport"
end

gem 'active_attr'
gem 'anima'
gem 'attr_extras'
gem 'benchmark-ips', '~> 2.5'
gem 'concord'
gem 'fast_attributes'
gem 'kwattr'
gem 'ruby-prof', platform: :mri
gem 'value_struct'
gem 'values'
gem 'virtus'
gem "active_attr"
gem "anima"
gem "attr_extras"
gem "benchmark-ips", "~> 2.5"
gem "concord"
gem "fast_attributes"
gem "kwattr"
gem "ruby-prof", platform: :mri
gem "value_struct"
gem "values"
gem "virtus"
end

group :development, :test do
gem 'pry', platform: :mri
gem 'pry-byebug', platform: :mri
gem "pry", platform: :mri
gem "pry-byebug", platform: :mri
end
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'bundler/setup'
require "bundler/setup"
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new :default

load 'lib/tasks/benchmark.rake'
load 'lib/tasks/profile.rake'
load "lib/tasks/benchmark.rake"
load "lib/tasks/profile.rake"
54 changes: 27 additions & 27 deletions benchmarks/compare_several_defaults.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundler.require(:benchmarks)

require 'dry-initializer'
require "dry-initializer"
class WithoutDefaults
extend Dry::Initializer

Expand All @@ -14,67 +14,67 @@ class WithOneDefault

param :foo
param :bar
param :baz, default: proc { 'BAZ' }
param :baz, default: proc { "BAZ" }
end

class WithTwoDefaults
extend Dry::Initializer

param :foo
param :bar, default: proc { 'BAR' }
param :baz, default: proc { 'BAZ' }
param :bar, default: proc { "BAR" }
param :baz, default: proc { "BAZ" }
end

class WithThreeDefaults
extend Dry::Initializer

param :foo, default: proc { 'FOO' }
param :bar, default: proc { 'BAR' }
param :baz, default: proc { 'BAZ' }
param :foo, default: proc { "FOO" }
param :bar, default: proc { "BAR" }
param :baz, default: proc { "BAZ" }
end

puts 'Benchmark for various options'
puts "Benchmark for various options"

Benchmark.ips do |x|
x.config time: 15, warmup: 10

x.report('without defaults') do
WithoutDefaults.new 'FOO', 'BAR', 'BAZ'
x.report("without defaults") do
WithoutDefaults.new "FOO", "BAR", "BAZ"
end

x.report('with 0 of 1 default used') do
WithOneDefault.new 'FOO', 'BAR', 'BAZ'
x.report("with 0 of 1 default used") do
WithOneDefault.new "FOO", "BAR", "BAZ"
end

x.report('with 1 of 1 default used') do
WithOneDefault.new 'FOO', 'BAR'
x.report("with 1 of 1 default used") do
WithOneDefault.new "FOO", "BAR"
end

x.report('with 0 of 2 defaults used') do
WithTwoDefaults.new 'FOO', 'BAR', 'BAZ'
x.report("with 0 of 2 defaults used") do
WithTwoDefaults.new "FOO", "BAR", "BAZ"
end

x.report('with 1 of 2 defaults used') do
WithTwoDefaults.new 'FOO', 'BAR'
x.report("with 1 of 2 defaults used") do
WithTwoDefaults.new "FOO", "BAR"
end

x.report('with 2 of 2 defaults used') do
WithTwoDefaults.new 'FOO'
x.report("with 2 of 2 defaults used") do
WithTwoDefaults.new "FOO"
end

x.report('with 0 of 3 defaults used') do
WithThreeDefaults.new 'FOO', 'BAR', 'BAZ'
x.report("with 0 of 3 defaults used") do
WithThreeDefaults.new "FOO", "BAR", "BAZ"
end

x.report('with 1 of 3 defaults used') do
WithThreeDefaults.new 'FOO', 'BAR'
x.report("with 1 of 3 defaults used") do
WithThreeDefaults.new "FOO", "BAR"
end

x.report('with 2 of 3 defaults used') do
WithThreeDefaults.new 'FOO'
x.report("with 2 of 3 defaults used") do
WithThreeDefaults.new "FOO"
end

x.report('with 3 of 3 defaults used') do
x.report("with 3 of 3 defaults used") do
WithThreeDefaults.new
end

Expand Down
28 changes: 14 additions & 14 deletions benchmarks/plain_options.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundler.require(:benchmarks)

require 'dry-initializer'
require "dry-initializer"
class DryTest
extend Dry::Initializer[undefined: false]

Expand All @@ -24,39 +24,39 @@ def initialize(options = {})
end
end

require 'anima'
require "anima"
class AnimaTest
include Anima.new(:foo, :bar)
end

require 'kwattr'
require "kwattr"
class KwattrTest
kwattr :foo, :bar
end

puts 'Benchmark for instantiation with plain options'
puts "Benchmark for instantiation with plain options"

Benchmark.ips do |x|
x.config time: 15, warmup: 10

x.report('plain Ruby') do
PlainRubyTest.new foo: 'FOO', bar: 'BAR'
x.report("plain Ruby") do
PlainRubyTest.new foo: "FOO", bar: "BAR"
end

x.report('dry-initializer') do
DryTest.new foo: 'FOO', bar: 'BAR'
x.report("dry-initializer") do
DryTest.new foo: "FOO", bar: "BAR"
end

x.report('dry-initializer (with UNDEFINED)') do
DryTestUndefined.new foo: 'FOO', bar: 'BAR'
x.report("dry-initializer (with UNDEFINED)") do
DryTestUndefined.new foo: "FOO", bar: "BAR"
end

x.report('anima') do
AnimaTest.new foo: 'FOO', bar: 'BAR'
x.report("anima") do
AnimaTest.new foo: "FOO", bar: "BAR"
end

x.report('kwattr') do
KwattrTest.new foo: 'FOO', bar: 'BAR'
x.report("kwattr") do
KwattrTest.new foo: "FOO", bar: "BAR"
end

x.compare!
Expand Down
44 changes: 22 additions & 22 deletions benchmarks/plain_params.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundler.require(:benchmarks)

require 'dry-initializer'
require "dry-initializer"
class DryTest
extend Dry::Initializer[undefined: false]

Expand All @@ -26,58 +26,58 @@ def initialize(foo, bar)

StructTest = Struct.new(:foo, :bar)

require 'concord'
require "concord"
class ConcordTest
include Concord.new(:foo, :bar)
end

require 'values'
require "values"
ValueTest = Value.new(:foo, :bar)

require 'value_struct'
require "value_struct"
ValueStructTest = ValueStruct.new(:foo, :bar)

require 'attr_extras'
require "attr_extras"
class AttrExtrasText
attr_initialize :foo, :bar
attr_reader :foo, :bar
end

puts 'Benchmark for instantiation with plain params'
puts "Benchmark for instantiation with plain params"

Benchmark.ips do |x|
x.config time: 15, warmup: 10

x.report('plain Ruby') do
PlainRubyTest.new 'FOO', 'BAR'
x.report("plain Ruby") do
PlainRubyTest.new "FOO", "BAR"
end

x.report('Core Struct') do
StructTest.new 'FOO', 'BAR'
x.report("Core Struct") do
StructTest.new "FOO", "BAR"
end

x.report('values') do
ValueTest.new 'FOO', 'BAR'
x.report("values") do
ValueTest.new "FOO", "BAR"
end

x.report('value_struct') do
ValueStructTest.new 'FOO', 'BAR'
x.report("value_struct") do
ValueStructTest.new "FOO", "BAR"
end

x.report('dry-initializer') do
DryTest.new 'FOO', 'BAR'
x.report("dry-initializer") do
DryTest.new "FOO", "BAR"
end

x.report('dry-initializer (with UNDEFINED)') do
DryTestUndefined.new 'FOO', 'BAR'
x.report("dry-initializer (with UNDEFINED)") do
DryTestUndefined.new "FOO", "BAR"
end

x.report('concord') do
ConcordTest.new 'FOO', 'BAR'
x.report("concord") do
ConcordTest.new "FOO", "BAR"
end

x.report('attr_extras') do
AttrExtrasText.new 'FOO', 'BAR'
x.report("attr_extras") do
AttrExtrasText.new "FOO", "BAR"
end

x.compare!
Expand Down
28 changes: 14 additions & 14 deletions benchmarks/with_coercion.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundler.require(:benchmarks)

require 'dry-initializer'
require "dry-initializer"
class DryTest
extend Dry::Initializer[undefined: false]

Expand All @@ -24,15 +24,15 @@ def initialize(options)
end
end

require 'virtus'
require "virtus"
class VirtusTest
include Virtus.model

attribute :foo, String
attribute :bar, String
end

require 'fast_attributes'
require "fast_attributes"
class FastAttributesTest
extend FastAttributes

Expand All @@ -42,29 +42,29 @@ class FastAttributesTest
end
end

puts 'Benchmark for instantiation with coercion'
puts "Benchmark for instantiation with coercion"

Benchmark.ips do |x|
x.config time: 15, warmup: 10

x.report('plain Ruby') do
PlainRubyTest.new foo: 'FOO', bar: 'BAR'
x.report("plain Ruby") do
PlainRubyTest.new foo: "FOO", bar: "BAR"
end

x.report('dry-initializer') do
DryTest.new foo: 'FOO', bar: 'BAR'
x.report("dry-initializer") do
DryTest.new foo: "FOO", bar: "BAR"
end

x.report('dry-initializer (with UNDEFINED)') do
DryTestUndefined.new foo: 'FOO', bar: 'BAR'
x.report("dry-initializer (with UNDEFINED)") do
DryTestUndefined.new foo: "FOO", bar: "BAR"
end

x.report('virtus') do
VirtusTest.new foo: 'FOO', bar: 'BAR'
x.report("virtus") do
VirtusTest.new foo: "FOO", bar: "BAR"
end

x.report('fast_attributes') do
FastAttributesTest.new foo: 'FOO', bar: 'BAR'
x.report("fast_attributes") do
FastAttributesTest.new foo: "FOO", bar: "BAR"
end

x.compare!
Expand Down
Loading

0 comments on commit 78f36e8

Please sign in to comment.