samples: document ways of using prefix

dev
Andy Meneely 2019-05-22 16:01:13 -04:00
parent 8e4ef3ba11
commit 8938aa350a
2 changed files with 25 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Docs:
* Documented the n-sided-ness of polygons and stars * Documented the n-sided-ness of polygons and stars
* svg: document rasterization on mask (#192) * svg: document rasterization on mask (#192)
* Document how to run the code (#186) * Document how to run the code (#186)
* Document some ways of using `prefix` in `save_png` (#268)
Chores: Chores:
* Bumped deps: Pango et al. to 3.3.6, Cairo to 1.16.4, Nokogiri to 1.10.3, Highline to 2.0.2 * Bumped deps: Pango et al. to 3.3.6, Cairo to 1.16.4, Nokogiri to 1.10.3, Highline to 2.0.2

View File

@ -0,0 +1,24 @@
require 'squib'
# This demonstrates the many ways you can save file to save_png and the like
Squib::Deck.new(width: 50, height: 50, cards: 2) do
background color: :white
text str: (0..16).to_a, font: 'Arial Bold 12'
# three digits, e.g. save_three_digits_000.png
save_png prefix: 'save_three_digits_', count_format: '%03d'
# foo_0.png
# bar_1.png
save_png prefix: ['foo_', 'bar_'], count_format: '%01d'
# foo.png
# bar.png
save_png prefix: ['foo', 'bar'], count_format: ''
# thief.png
# thug.png
data = csv data: "filename\nthief\nthug"
save_png prefix: data.filename, count_format: ''
end