Class: GeoPattern::BackgroundGenerators::SolidGenerator

Inherits:
Object
  • Object
show all
Includes:
Roles::NamedGenerator
Defined in:
lib/geo_pattern/background_generators/solid_generator.rb

Overview

Generating a solid background

Instance Method Summary collapse

Methods included from Roles::NamedGenerator

#name, #name?

Constructor Details

#initialize(seed, preset) ⇒ SolidGenerator

New generator


21
22
23
24
# File 'lib/geo_pattern/background_generators/solid_generator.rb', line 21

def initialize(seed, preset)
  @color  = color_for(seed, preset)
  @preset = preset
end

Instance Method Details

#generate(pattern) ⇒ Object

Generate the background for pattern


30
31
32
33
34
# File 'lib/geo_pattern/background_generators/solid_generator.rb', line 30

def generate(pattern)
  pattern.background = Background.new(image: generate_background, preset: preset, color: color, generator: self.class)

  self
end