Class: Bitgen::Generator
- Inherits:
-
Object
- Object
- Bitgen::Generator
- Defined in:
- lib/bitgen.rb
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
Class Method Summary collapse
Instance Method Summary collapse
-
#cheat ⇒ Object
more convenience helpers.
- #generate(**kwargs) ⇒ Object
-
#initialize(catalog) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(catalog) ⇒ Generator
Returns a new instance of Generator.
98 99 100 |
# File 'lib/bitgen.rb', line 98 def initialize( catalog ) @catalog = catalog end |
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
96 97 98 |
# File 'lib/bitgen.rb', line 96 def catalog @catalog end |
Class Method Details
Instance Method Details
#cheat ⇒ Object
more convenience helpers
123 |
# File 'lib/bitgen.rb', line 123 def cheat() @catalog.cheat; end |
#generate(**kwargs) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/bitgen.rb', line 102 def generate( **kwargs ) img = nil kwargs.each do |category, name| cat = @catalog[ category.to_s] attribute_img = cat[name.to_s] if attribute_img.nil? puts "!! WARN - attribute >#{name}< in >#{category}< not found; sorry" puts " availbable options in #{category}:" pp cat.keys end img = Image.new( attribute_img.width, attribute_img.height ) if img.nil? img.compose!( attribute_img ) end img end |