class Ranicoma::Creator

Attributes

doc[R]
rng[R]
size[R]

Public Class Methods

new( seed, size ) click to toggle source
# File lib/ranicoma/creator.rb, line 9
def initialize( seed, size )
  @rng=Random.new(seed)
  @size=size
  @doc = REXML::Document.new
  @doc << REXML::XMLDecl.new('1.0', 'UTF-8')
end

Public Instance Methods

create() click to toggle source
# File lib/ranicoma/creator.rb, line 19
def create
  design = Design::Base.subclasses.sample( random:rng ).new(rng)
  doc << (
    element("svg", xmlns:"http://www.w3.org/2000/svg", height:"#{size}px", width:"#{size}px", viewBox:"0 0 1 1" ){
      design.create
    }
  )
end