diff --git a/Rakefile b/Rakefile
index 904a20a..72b6063 100644
--- a/Rakefile
+++ b/Rakefile
@@ -13,7 +13,7 @@ desc 'Run a specific sample'
task :run, [:file] => :install do |t, args|
args.with_defaults(file: 'basic.rb')
Dir.chdir('samples') do
- args[:file] << ".rb" unless args[:file].end_with? '.rb'
+ args[:file] << '.rb' unless args[:file].end_with? '.rb'
puts "Running samples/#{args[:file]}"
load args[:file]
end
@@ -23,7 +23,7 @@ end
RSpec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:spec_fastonly) do |t|
- t.rspec_opts = "--tag ~slow"
+ t.rspec_opts = '--tag ~slow'
end
desc 'Run some performance benchmarks'
diff --git a/benchmarks/backend_memory.rb b/benchmarks/backend_memory.rb
index 7a6271b..ff80581 100644
--- a/benchmarks/backend_memory.rb
+++ b/benchmarks/backend_memory.rb
@@ -2,7 +2,7 @@ require 'squib'
Squib::Deck.new(cards: 200) do
background color: :white
- text str: "Hello, world!", y: 500, width: 825, font: 'Sans bold 72', align: :center
+ text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center
rect x: 10, y: 10, width: 20, height: 20
circle x: 40, y: 40, radius: 25
triangle x1: 50, y1: 15, x2: 60, y2: 25, x3: 75, y3: 25
diff --git a/benchmarks/backend_svg.rb b/benchmarks/backend_svg.rb
index bdd0d2f..ed8f31f 100644
--- a/benchmarks/backend_svg.rb
+++ b/benchmarks/backend_svg.rb
@@ -2,7 +2,7 @@ require 'squib'
Squib::Deck.new(cards: 200, config: 'backend-svg.yml') do
background color: :white
- text str: "Hello, world!", y: 500, width: 825, font: 'Sans bold 72', align: :center
+ text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center
rect x: 10, y: 10, width: 20, height: 20
circle x: 40, y: 40, radius: 25
triangle x1: 50, y1: 15, x2: 60, y2: 25, x3: 75, y3: 25
diff --git a/lib/squib/graphics/text.rb b/lib/squib/graphics/text.rb
index bd4510e..fa86070 100644
--- a/lib/squib/graphics/text.rb
+++ b/lib/squib/graphics/text.rb
@@ -167,10 +167,10 @@ module Squib
begin
embed_draws.each { |ed| ed[:draw].call(self, ed[:x], ed[:y] + vertical_start) }
rescue Exception => e
- puts "====EXCEPTION!===="
+ puts '====EXCEPTION!===='
puts e
- puts "If this was a non-invertible matrix error, this is a known issue with a potential workaround. Please report it at: https://github.com/andymeneely/squib/issues/55"
- puts "=================="
+ puts 'If this was a non-invertible matrix error, this is a known issue with a potential workaround. Please report it at: https://github.com/andymeneely/squib/issues/55'
+ puts '=================='
raise e
end
draw_text_hint(cc, box.x, box.y, layout, para.hint)
diff --git a/samples/backend.rb b/samples/backend.rb
index c8f57ba..730d682 100644
--- a/samples/backend.rb
+++ b/samples/backend.rb
@@ -5,7 +5,7 @@ Squib::Deck.new(cards: 2, config: 'backend-config.yml') do
# These are all supported by the SVG backend
background color: :gray
- text str: "Hello, world!", y: 500, width: 825, font: 'Sans bold 72', align: :center
+ text str: 'Hello, world!', y: 500, width: 825, font: 'Sans bold 72', align: :center
rect x: 38, y: 38, width: 750, height: 1050, x_radius: 38, y_radius: 38
circle x: 100, y: 400, radius: 25
triangle x1: 100, y1: 425, x2: 125, y2: 475, x3: 75, y3: 475
diff --git a/samples/config_text_markup.rb b/samples/config_text_markup.rb
index cd152f8..42c3007 100644
--- a/samples/config_text_markup.rb
+++ b/samples/config_text_markup.rb
@@ -6,7 +6,7 @@ Squib::Deck.new(config: 'config_text_markup.yml') do
x: 10, y: 10, width: 300, height: 200, font: 'Serif 20',
markup: true, hint: :cyan
- text str: "Notice also the antialiasing method.",
+ text str: 'Notice also the antialiasing method.',
x: 320, y: 10, width: 300, height: 200, font: 'Arial Bold 20'
save_png prefix: 'config_text_'
diff --git a/samples/layouts.rb b/samples/layouts.rb
index 1f5298c..bd27c34 100644
--- a/samples/layouts.rb
+++ b/samples/layouts.rb
@@ -46,7 +46,7 @@ end
Squib::Deck.new(layout: 'playing-card.yml') do
text str: "A\u2660", layout: :bonus_ul, font: 'Sans bold 100', hint: :red
text str: "A\u2660", layout: :bonus_lr, font: 'Sans bold 100', hint: :red
- text str: "artwork here", layout: :art, hint: :red
+ text str: 'artwork here', layout: :art, hint: :red
save_png prefix: 'layout_builtin_playing_card_'
end
diff --git a/samples/text_options.rb b/samples/text_options.rb
index 2af28ff..250c94a 100644
--- a/samples/text_options.rb
+++ b/samples/text_options.rb
@@ -79,15 +79,15 @@ Squib::Deck.new(width: 825, height: 1125, cards: 3) do
embed.svg key: ':health:', width: 28, height: 28, file: 'glass-heart.svg'
end
- text str: "Fill n stroke",
+ text str: 'Fill n stroke',
color: :green, stroke_width: 2.0, stroke_color: :blue,
x: '1.8in', y: '2.9in', width: '0.85in', font: 'Sans Bold 26', markup: true
- text str: "Stroke n fill",
+ text str: 'Stroke n fill',
color: :green, stroke_width: 2.0, stroke_color: :blue, stroke_strategy: :stroke_first,
x: '1.8in', y: '3.0in', width: '0.85in', font: 'Sans Bold 26', markup: true
- text str: "Dotted",
+ text str: 'Dotted',
color: :white, stroke_width: 2.0, dash: '4 2', stroke_color: :black,
x: '1.8in', y: '3.1in', width: '0.85in', font: 'Sans Bold 26', markup: true
#
diff --git a/spec/args/typographer_spec.rb b/spec/args/typographer_spec.rb
index bd0e7c2..98a4c78 100644
--- a/spec/args/typographer_spec.rb
+++ b/spec/args/typographer_spec.rb
@@ -24,40 +24,40 @@ describe Squib::Args::Typographer do
expect(t.process(%{"foo"})).to eq(%{\u201Cfoo\u201D})
end
- it "quotes in the middle of the string" do
+ it 'quotes in the middle of the string' do
expect(t.process(%{hello "foo" world})).to eq(%{hello \u201Cfoo\u201D world})
end
- it "single left quotes at the beginning" do
+ it 'single left quotes at the beginning' do
expect(t.process(%{'foo})).to eq(%{\u2018foo})
end
- it "single right quotes at the end" do
+ it 'single right quotes at the end' do
expect(t.process(%{foo'})).to eq(%{foo\u2019})
end
- it "single quotes in the middle" do
+ it 'single quotes in the middle' do
expect(t.process(%{a 'foo' bar})).to eq(%{a \u2018foo\u2019 bar})
end
- it "handles apostraphes" do
+ it 'handles apostraphes' do
expect(t.process(%{can't})).to eq(%{can\u2019t})
end
-it "single quotes inside double quotes" do
+it 'single quotes inside double quotes' do
expect(t.process(%{"'I can't do that', he said"})).to eq(%{\u201C\u2018I can\u2019t do that\u2019, he said\u201D})
end
- it "replaces the straightforward ones" do
+ it 'replaces the straightforward ones' do
expect(t.process(%{``hi...'' -- ---})).to eq(%{\u201Chi\u2026\u201D \u2013 \u2014})
end
- it "does nothing on lone quotes" do
+ it 'does nothing on lone quotes' do
expect(t.process(%{"})).to eq(%{"})
expect(t.process(%{'})).to eq(%{'})
end
- it "ignores stuff in " do
+ it 'ignores stuff in ' do
expect(t.process(%{"can't"})).to eq(%{\u201Ccan\u2019t\u201D})
end
diff --git a/spec/logger_spec.rb b/spec/logger_spec.rb
index 8fc8161..3bc61bc 100644
--- a/spec/logger_spec.rb
+++ b/spec/logger_spec.rb
@@ -5,7 +5,7 @@ describe Squib.logger do
Squib.logger = nil
oldstdout = $stdout
$stdout = StringIO.new
- Squib::logger.warn "Test warn"
+ Squib::logger.warn 'Test warn'
expect($stdout.string).to match /WARN: Test warn/
$stdout = oldstdout
end
diff --git a/spec/samples/run_samples_spec.rb b/spec/samples/run_samples_spec.rb
index db6b46a..16354ab 100644
--- a/spec/samples/run_samples_spec.rb
+++ b/spec/samples/run_samples_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'squib'
require 'pp'
-describe "Squib samples" do
+describe 'Squib samples' do
Dir["#{samples_dir}/**/*.rb"].each do |sample|
it "executes #{sample} with no errors", slow: true do
diff --git a/spec/samples/samples_regression_spec.rb b/spec/samples/samples_regression_spec.rb
index 4d95b87..4326074 100644
--- a/spec/samples/samples_regression_spec.rb
+++ b/spec/samples/samples_regression_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'squib'
require 'pp'
-describe "Squib samples" do
+describe 'Squib samples' do
around(:each) do |example|
Dir.chdir(samples_dir) do
diff --git a/spec/samples/sanity.rb b/spec/samples/sanity.rb
index 2fc3560..ad65d48 100644
--- a/spec/samples/sanity.rb
+++ b/spec/samples/sanity.rb
@@ -14,14 +14,14 @@ class Sanity
def images
images = []
- exp_pngs = Dir[@@EXPECTED_DIR + "/**/*.png"]
+ exp_pngs = Dir[@@EXPECTED_DIR + '/**/*.png']
bar = ProgressBar.create(title: 'Diffing images', total: exp_pngs.size)
exp_pngs.each do |exp_png|
row = []
actual_png = @@OUTPUT_DIR + File.basename(exp_png)
- row << "file:///" + exp_png
- row << "file:///" + actual_png # actual
- row << "file:///" + diff_image(exp_png, actual_png)
+ row << 'file:///' + exp_png
+ row << 'file:///' + actual_png # actual
+ row << 'file:///' + diff_image(exp_png, actual_png)
images << row
bar.increment
end
@@ -30,11 +30,11 @@ class Sanity
end
def run
- puts "Building sanity test..."
+ puts 'Building sanity test...'
sanity_template = File.read(@@SANITY_ERB)
process_erb(sanity_template)
- Launchy.open("file:///" + @@SANITY_HTML)
- puts "Done."
+ Launchy.open('file:///' + @@SANITY_HTML)
+ puts 'Done.'
end
private
@@ -51,7 +51,7 @@ class Sanity
end
end
out = Cairo::ImageSurface.new(new_data.pack('c*'), exp.format, exp.width, exp.height, exp.stride)
- out_file = @@DIFF_DIR + exp_file[exp_file.rindex("/")..-1]
+ out_file = @@DIFF_DIR + exp_file[exp_file.rindex('/')..-1]
out.write_to_png(out_file)
out_file
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 14ed38e..5654e17 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -101,7 +101,7 @@ def mock_cairo(strio)
allow(pango).to receive(:extents).and_return([Pango::Rectangle.new(0, 0, 0, 0)] * 2)
allow(pango).to receive(:iter).and_return(iter)
allow(pango).to receive(:alignment).and_return(Pango::Layout::Alignment::LEFT)
- allow(pango).to receive(:text).and_return("foo")
+ allow(pango).to receive(:text).and_return('foo')
allow(pango).to receive(:context).and_return(pango_cxt)
allow(pango_cxt).to receive(:font_options=)
allow(iter).to receive(:next_char!).and_return(false)