Class: Cheers::Background
- Defined in:
- lib/cheers/background.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
Attributes inherited from Component
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(canvas, randomizer) ⇒ Background
constructor
A new instance of Background.
Methods inherited from Component
#base_image, #colored_image, #composite_with_mask, #extract_background_color, #image_path
Constructor Details
#initialize(canvas, randomizer) ⇒ Background
Returns a new instance of Background.
6 7 8 9 10 |
# File 'lib/cheers/background.rb', line 6 def initialize(canvas, randomizer) super @color = Avatar::BACKGROUND_COLORS.sample(random: randomizer) end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
4 5 6 |
# File 'lib/cheers/background.rb', line 4 def color @color end |
Instance Method Details
#apply ⇒ Object
12 13 14 15 16 17 |
# File 'lib/cheers/background.rb', line 12 def apply # Work around instance_eval wonkiness by declaring local variables: color = self.color colored_image(color) end |