Class: Originals::Image

Inherits:
Pixelart::Image
  • Object
show all
Defined in:
lib/originals.rb,
lib/originals.rb

Overview

“wrap” fabricate inside Image - why? why not?

Class Method Summary collapse

Class Method Details

.fabricate(name, *attributes, background: nil) ⇒ Object Also known as: fab

add fac alias - why? why not?



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/originals.rb', line 28

def self.fabricate( name, *attributes, background: nil )  ## add fac alias - why? why not?
   ## normalize name of series
   ##   e.g.   Shiba Inu  => shibainu  etc.
   key = name.downcase.gsub( '[ ()_-]', '' )

   img =  if ['punk', 'punks',
              'cryptopunk', 'cryptopunks'].include?( key )
              Originals.factory.punk( *attributes, background: background )
          elsif ['phunk', 'phunks',
            'cryptophunk', 'cryptophunks'].include?( key )
              Originals.factory.phunk( *attributes, background: background )
          elsif ['marilyn', 'marilyns' ].include?( key )
              Originals.factory.marilyn( *attributes, background: background )
          elsif ['philip', 'philips',
                 'philipp', 'philipps' ].include?( key )
              Originals.factory.philip( *attributes, background: background )
          elsif ['doge', 'doges',
                 'shiba', 'shibas',
                 'shibainu', 'shibainus'].include?( key )
              Originals.factory.shiba( *attributes, background: background )
          else
            puts "!! ERROR; don't know how to fabricate >#{name}<; sorry"
            exit 1
          end
   img
end