You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
930 B
44 lines
930 B
require 'squib/card' |
|
|
|
module Squib |
|
class Deck |
|
include Enumerable |
|
attr_reader :width, :height |
|
attr_reader :cards |
|
|
|
def initialize(width: 825, height: 1125, cards: 1, &block) |
|
@width=width; @height=height |
|
@cards = [] |
|
cards.times{ @cards << Squib::Card.new(width, height) } |
|
if block_given? |
|
instance_eval(&block) |
|
end |
|
end |
|
|
|
def [](key) |
|
@cards[key] |
|
end |
|
|
|
#For Enumerable |
|
def each(&block) |
|
@cards.each { |card| block.call(card) } |
|
end |
|
|
|
def rangeify (range) |
|
range = 0..(@cards.size-1) if range == :all |
|
range = range..range if range.is_a? Integer |
|
return range |
|
end |
|
|
|
################## |
|
### PUBLIC API ### |
|
################## |
|
require 'squib/api/background' |
|
require 'squib/api/data' |
|
require 'squib/api/image' |
|
require 'squib/api/save' |
|
require 'squib/api/shapes' |
|
require 'squib/api/text' |
|
|
|
end |
|
end |