samples: document ways of using prefix
parent
8e4ef3ba11
commit
8938aa350a
|
|
@ -10,6 +10,7 @@ Docs:
|
|||
* Documented the n-sided-ness of polygons and stars
|
||||
* svg: document rasterization on mask (#192)
|
||||
* Document how to run the code (#186)
|
||||
* Document some ways of using `prefix` in `save_png` (#268)
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue