Rubocop: Trailing Whitespace
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module Squib
|
||||
class Deck
|
||||
# Fills the background with the given color
|
||||
# Fills the background with the given color
|
||||
# @example
|
||||
# background color: :white
|
||||
#
|
||||
@@ -14,6 +14,6 @@ module Squib
|
||||
opts = needs(opts,[:range, :color])
|
||||
opts[:range].each { |i| @cards[i].background(opts[:color][i]) }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -4,13 +4,13 @@ module Squib
|
||||
|
||||
# Pulls Excel data from `.xlsx` files into a column-based hash
|
||||
#
|
||||
# Pulls the data into a Hash of arrays based on the columns. First row is assumed to be the header row.
|
||||
# Pulls the data into a Hash of arrays based on the columns. First row is assumed to be the header row.
|
||||
# See the example `samples/excel.rb` in the [source repository](https://github.com/andymeneely/squib/tree/master/samples)
|
||||
#
|
||||
# @example
|
||||
# # Excel file looks like this:
|
||||
# # | h1 | h2 |
|
||||
# # ------------
|
||||
# # ------------
|
||||
# # | 1 | 2 |
|
||||
# # | 3 | 4 |
|
||||
# data = xlsx file: 'data.xlsx', sheet: 0
|
||||
@@ -41,11 +41,11 @@ module Squib
|
||||
module_function :xlsx
|
||||
|
||||
class Deck
|
||||
|
||||
|
||||
# Convenience call for Squib.xlsx
|
||||
def xlsx(opts = {})
|
||||
Squib.xlsx(opts)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,8 +21,8 @@ module Squib
|
||||
opts = needs(opts, [:range, :files, :x, :y, :alpha, :layout, :blend])
|
||||
Dir.chdir(@img_dir) do
|
||||
@progress_bar.start("Loading PNG(s)", opts[:range].size) do |bar|
|
||||
opts[:range].each do |i|
|
||||
@cards[i].png(opts[:file][i], opts[:x][i], opts[:y][i], opts[:alpha][i], opts[:blend][i])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].png(opts[:file][i], opts[:x][i], opts[:y][i], opts[:alpha][i], opts[:blend][i])
|
||||
bar.increment
|
||||
end
|
||||
end
|
||||
@@ -32,7 +32,7 @@ module Squib
|
||||
# Renders an entire svg file at the given location. Uses the SVG-specified units and DPI to determine the pixel width and height.
|
||||
#
|
||||
# See {file:samples/load-images.rb samples/load-images.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
|
||||
# @example
|
||||
# @example
|
||||
# svg 1..2, 'icon.svg', '#stone', x: 50, y:50
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
@@ -54,8 +54,8 @@ module Squib
|
||||
@progress_bar.start("Loading SVG(s)", p[:range].size) do |bar|
|
||||
p[:range].each do |i|
|
||||
unless p[:force_id][i] && p[:id][i].to_s.empty?
|
||||
@cards[i].svg(p[:file][i], p[:id][i], p[:x][i], p[:y][i],
|
||||
p[:width][i], p[:height][i], p[:alpha][i], p[:blend][i])
|
||||
@cards[i].svg(p[:file][i], p[:id][i], p[:x][i], p[:y][i],
|
||||
p[:width][i], p[:height][i], p[:alpha][i], p[:blend][i])
|
||||
end
|
||||
bar.increment
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Squib
|
||||
class Deck
|
||||
|
||||
|
||||
# Saves the given range of cards to either PNG or PDF
|
||||
#
|
||||
# @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
@@ -16,8 +16,8 @@ module Squib
|
||||
save_pdf(opts) if opts[:format].include? :pdf
|
||||
self
|
||||
end
|
||||
|
||||
# Saves the given range of cards to a PNG
|
||||
|
||||
# Saves the given range of cards to a PNG
|
||||
#
|
||||
# @example
|
||||
# save range: 1..8, dir: '_pnp', prefix: 'bw_'
|
||||
@@ -31,7 +31,7 @@ module Squib
|
||||
def save_png(opts = {})
|
||||
opts = needs(opts,[:range, :creatable_dir, :prefix, :rotate])
|
||||
@progress_bar.start("Saving PNGs to #{opts[:dir]}/#{opts[:prefix]}*", @cards.size) do |bar|
|
||||
opts[:range].each do |i|
|
||||
opts[:range].each do |i|
|
||||
@cards[i].save_png(i, opts[:dir], opts[:prefix], opts[:rotate], opts[:angle])
|
||||
bar.increment
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Squib
|
||||
class Deck
|
||||
|
||||
# Toggle hints globally.
|
||||
# Toggle hints globally.
|
||||
#
|
||||
# Text hints are rectangles around where the text will be laid out. They are intended to be temporary.
|
||||
# Setting a hint to nil or to :off will disable hints. @see samples/text.rb
|
||||
@@ -9,7 +9,7 @@ module Squib
|
||||
# hint text: :cyan
|
||||
# hint text: :cyan
|
||||
#
|
||||
# @param [String] text the color of the text hint. To turn off use :off. @see README.md
|
||||
# @param [String] text the color of the text hint. To turn off use :off. @see README.md
|
||||
# @return [nil] Returns nothing
|
||||
# @api public
|
||||
def hint(text: :off)
|
||||
@@ -17,7 +17,7 @@ module Squib
|
||||
end
|
||||
|
||||
# Sets various defaults for this deck. Defaults can be overriden by the commands themselves when that command supports it.
|
||||
# @example
|
||||
# @example
|
||||
# set font: 'Arial 26'
|
||||
# text 'blah' # in Arial 26
|
||||
# text 'blah24', font: 'Arial 24' # in Arial 24
|
||||
@@ -31,7 +31,7 @@ module Squib
|
||||
opts = needs(opts, [:font, :img_dir])
|
||||
@font = opts[:font][0] #was expanded - just need the first
|
||||
@img_dir = opts[:img_dir]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
+19
-19
@@ -1,11 +1,11 @@
|
||||
module Squib
|
||||
class Deck
|
||||
|
||||
|
||||
# Draw a rounded rectangle
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# @example
|
||||
# rect x: 0, y: 0, width: 825, height: 1125, radius: 25
|
||||
#
|
||||
#
|
||||
# Options support Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
@@ -26,16 +26,16 @@ module Squib
|
||||
opts = needs(opts, [:range, :x, :y, :width, :height, :rect_radius, :x_radius, :y_radius,
|
||||
:fill_color, :stroke_color, :stroke_width, :layout])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].rect(opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
|
||||
opts[:x_radius][i], opts[:y_radius][i],
|
||||
opts[:fill_color][i], opts[:stroke_color][i],
|
||||
@cards[i].rect(opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
|
||||
opts[:x_radius][i], opts[:y_radius][i],
|
||||
opts[:fill_color][i], opts[:stroke_color][i],
|
||||
opts[:stroke_width][i])
|
||||
end
|
||||
end
|
||||
|
||||
# Draw a circle centered at the given coordinates
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# @example
|
||||
# circle x: 0, y: 0, radius: 100
|
||||
#
|
||||
# Options support Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
|
||||
@@ -54,14 +54,14 @@ module Squib
|
||||
opts = needs(opts, [:range, :x, :y, :circle_radius, :layout,
|
||||
:fill_color, :stroke_color, :stroke_width])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].circle(opts[:x][i], opts[:y][i], opts[:radius][i],
|
||||
@cards[i].circle(opts[:x][i], opts[:y][i], opts[:radius][i],
|
||||
opts[:fill_color][i], opts[:stroke_color][i], opts[:stroke_width][i])
|
||||
end
|
||||
end
|
||||
|
||||
# Draw a triangle using the given coordinates
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# @example
|
||||
# triangle :x1 => 0, :y1 => 0, :x2 => 50, :y2 => 50, :x3 => 0, :y3 => 50
|
||||
#
|
||||
# Options support Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
|
||||
@@ -82,17 +82,17 @@ module Squib
|
||||
opts = needs(opts, [:range, :x1, :y1, :x2, :y2, :x3, :y3, :layout,
|
||||
:fill_color, :stroke_color, :stroke_width])
|
||||
opts[:range].each do |i|
|
||||
@cards[i].triangle(opts[:x1][i], opts[:y1][i],
|
||||
opts[:x2][i], opts[:y2][i],
|
||||
opts[:x3][i], opts[:y3][i],
|
||||
opts[:fill_color][i], opts[:stroke_color][i],
|
||||
@cards[i].triangle(opts[:x1][i], opts[:y1][i],
|
||||
opts[:x2][i], opts[:y2][i],
|
||||
opts[:x3][i], opts[:y3][i],
|
||||
opts[:fill_color][i], opts[:stroke_color][i],
|
||||
opts[:stroke_width][i])
|
||||
end
|
||||
end
|
||||
|
||||
# Draw a line using the given coordinates
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# @example
|
||||
# triangle :x1 => 0, :y1 => 0, :x2 => 50, :y2 => 50
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
@@ -112,6 +112,6 @@ module Squib
|
||||
opts[:stroke_color][i], opts[:stroke_width][i])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
+10
-10
@@ -3,20 +3,20 @@ module Squib
|
||||
|
||||
# Renders a string at a given location, width, alignment, font, etc.
|
||||
#
|
||||
# Unix-like newlines are interpreted even on Windows.
|
||||
# Unix-like newlines are interpreted even on Windows.
|
||||
# See the {file:samples/text-options.rb samples/text.rb} for a lengthy example.
|
||||
#
|
||||
# @example
|
||||
# @example
|
||||
# text str: 'hello'
|
||||
# text str: 'hello', x: 50, y:50, align: center
|
||||
#
|
||||
#
|
||||
# Options support Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
|
||||
#
|
||||
# @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
|
||||
# @option opts str [String, Array] ('') the string to be rendered. Must support `#to_s`. If the card responds to `#each`, it's mapped out one at a time across the cards.
|
||||
# @option opts font [String] (Arial 36 or whatever was set with `set`) the Font description string, including family, styles, and size.
|
||||
# (e.g. `'Arial bold italic 12'`)
|
||||
# For the official documentation, see the [Pango docs](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Pango%3A%3AFontDescription#style).
|
||||
# For the official documentation, see the [Pango docs](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Pango%3A%3AFontDescription#style).
|
||||
# This [description](http://www.pygtk.org/pygtk2reference/class-pangofontdescription.html) is also quite good.
|
||||
# See the {file:samples/text-options.rb samples/text.rb} as well.
|
||||
# @option opts font_size [Integer] (nil) an override of font string description, for scaling the font according to the size of the string
|
||||
@@ -27,15 +27,15 @@ module Squib
|
||||
# @option opts width [Integer, :native] (:native) the width of the box the string will be placed in. Stretches to the content by default.
|
||||
# @option opts height [Integer, :native] the height of the box the string will be placed in. Stretches to the content by default.
|
||||
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}
|
||||
# @option opts wrap [:none, :word, :char, :word_char, true, false] (:word_char) When height is set, determines the behavior of how the string wraps. The `:word_char` option will break at words, but then fall back to characters when the word cannot fit. #
|
||||
# @option opts wrap [:none, :word, :char, :word_char, true, false] (:word_char) When height is set, determines the behavior of how the string wraps. The `:word_char` option will break at words, but then fall back to characters when the word cannot fit. #
|
||||
# Options are `:none, :word, :char, :word_char`. Also: `true` is the same as `:word_char`, `false` is the same as `:none`. Default `:word_char`
|
||||
# @option opts spacing [Integer] (0) Adjust the spacing when the text is multiple lines. No effect when the text does not wrap.
|
||||
# @option opts align [:left, right, :center] (:left) The alignment of the text
|
||||
# @option opts justify [Boolean] (false) toggles whether or not the text is justified or not.
|
||||
# @option opts justify [Boolean] (false) toggles whether or not the text is justified or not.
|
||||
# @option opts valign [:top, :middle, :bottom] (:top) When width and height are set, align text vertically according to the ink extents of the text.
|
||||
# @option opts ellipsize [:none, :start, :middle, :end, true, false] (:end) When width and height are set, determines the behavior of overflowing text. Also: `true` maps to `:end` and `false` maps to `:none`. Default `:end`
|
||||
# @option opts angle [FixNum] (0) Rotation of the text in radians.
|
||||
# @option opts hint [String] (:nil) draw a rectangle around the text with the given color. Overrides global hints (see {Deck#hint}).
|
||||
# @option opts angle [FixNum] (0) Rotation of the text in radians.
|
||||
# @option opts hint [String] (:nil) draw a rectangle around the text with the given color. Overrides global hints (see {Deck#hint}).
|
||||
# @return [nil] Returns nothing
|
||||
# @api public
|
||||
def text(opts = {})
|
||||
@@ -44,8 +44,8 @@ module Squib
|
||||
opts[:range].each do |i|
|
||||
@cards[i].text(opts[:str][i], opts[:font][i], opts[:font_size][i], opts[:color][i],
|
||||
opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
|
||||
opts[:markup][i], opts[:justify][i], opts[:wrap][i],
|
||||
opts[:ellipsize][i], opts[:spacing][i], opts[:align][i],
|
||||
opts[:markup][i], opts[:justify][i], opts[:wrap][i],
|
||||
opts[:ellipsize][i], opts[:spacing][i], opts[:align][i],
|
||||
opts[:valign][i], opts[:hint][i], opts[:angle][i])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,8 +2,8 @@ module Squib
|
||||
class Deck
|
||||
|
||||
# Given inches, returns the number of pixels according to the deck's DPI.
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# @example
|
||||
# inches(2.5) # 750 (for default Deck::dpi of 300)
|
||||
#
|
||||
# @param [Decimal] n, the number of inches
|
||||
|
||||
Reference in New Issue
Block a user