Still messing around
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
module Squib
|
||||
|
||||
class Card
|
||||
def initialize(width: 825, height: 1125)
|
||||
@width=width, @height=height
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
module Squib
|
||||
module Commands
|
||||
|
||||
module Visitable
|
||||
def accept visitor
|
||||
visitor.visit self
|
||||
end
|
||||
end
|
||||
|
||||
class Command
|
||||
def accept visitor
|
||||
raise NotImpelementedError.new
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
module Squib
|
||||
module Commands
|
||||
|
||||
class Font < Command
|
||||
include Visitable
|
||||
attr_accessor :type, :size
|
||||
|
||||
def initialize(type,size, options)
|
||||
@type = type
|
||||
@size = size
|
||||
#no other options yet
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
module Squib
|
||||
module Commands
|
||||
|
||||
class SetFont < Command
|
||||
include Visitable
|
||||
attr_accessor :type, :size, :options
|
||||
|
||||
def initialize(type, size, options)
|
||||
@type = type
|
||||
@size = size
|
||||
#no options yet
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
module Squib
|
||||
|
||||
class TextCmd
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
require 'squib/card'
|
||||
module Squib
|
||||
|
||||
class Deck
|
||||
attr_reader :width, :height, :cards
|
||||
|
||||
def initialize(width: 825, height: 1125, cards: 1)
|
||||
@width=width; @height=height; @cards=cards
|
||||
@deck = Array.new(cards)
|
||||
(1..cards).each{ @deck << Squib::Card.new(width: width, height: height) }
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
module Squib
|
||||
#Global queue of commands
|
||||
CMDS = []
|
||||
|
||||
def queue_command(cmd)
|
||||
unless cmd.instance_of? Squib::Commands::Command
|
||||
raise ArgumentError, "Only RockDeck::Commands allowed here"
|
||||
end
|
||||
CMDS << cmd
|
||||
end
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
module Squib
|
||||
module Visitors
|
||||
|
||||
class BaseVisitor
|
||||
def visit subject
|
||||
method_name = "visit_#{subject.class}".intern
|
||||
send(method_name, subject)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
module Squib
|
||||
module Visitors
|
||||
|
||||
class VerifyVistior < BaseVisitor
|
||||
def visit_Font
|
||||
puts "Verify Font!!"
|
||||
end
|
||||
|
||||
def visit_SetFont
|
||||
puts "Verify SetFont!!"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user