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.
90 91 92 |
# File 'lib/bitgen.rb', line 90 def initialize( catalog ) @catalog = catalog end |
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
88 89 90 |
# File 'lib/bitgen.rb', line 88 def catalog @catalog end |
Class Method Details
.read(path) ⇒ Object
83 84 85 86 |
# File 'lib/bitgen.rb', line 83 def self.read( path ) catalog = Catalog.read( path ) new( catalog ) end |
Instance Method Details
#cheat ⇒ Object
more convenience helpers
115 |
# File 'lib/bitgen.rb', line 115 def cheat() @catalog.cheat; end |
#generate(**kwargs) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/bitgen.rb', line 94 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 |