From 9f32ee22afaf5309c65f08bbbda23369f5b88adb Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Mon, 11 Aug 2014 16:13:31 -0400 Subject: [PATCH] Added a sample to show how singleton expansions works --- samples/ranges.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/ranges.rb b/samples/ranges.rb index f07cdda..c98b58b 100644 --- a/samples/ranges.rb +++ b/samples/ranges.rb @@ -29,6 +29,14 @@ Squib::Deck.new(width: 825, height: 1125, cards: 3) do # We can use Arrays too! text range: [0,2], str: "Thief and Mastermind only!!", x: 25, y:300 + # Just about everything in Squib can be given an array that + # corresponds to the deck's cards. + # This allows for each card to be styled differently + text str: %w(red green blue), + color: [:red, :green, :blue], + x: [40, 80, 120], + y: [700, 750, 800] + # Useful idiom: construct a hash from card names back to its index (ID), # then use a range. No need to memorize IDs, and you can add cards easily id = {} ; data['name'].each_with_index{ |name,i| id[name] = i}