Class: WSLight::Set::RandomSet

Inherits:
ColorSet
  • Object
show all
Defined in:
lib/ws_light/set/random_set.rb

Overview

Creates a set with all random colors

Constant Summary

Constants inherited from ColorSet

ColorSet::DEFAULT_LENGTH, ColorSet::DEFAULT_TYPE

Instance Attribute Summary

Attributes inherited from ColorSet

#color, #full_length, #length, #type

Instance Method Summary collapse

Methods inherited from ColorSet

#frame_data, #init, #initialize, #next_frame

Constructor Details

This class inherits a constructor from WSLight::Set::ColorSet

Instance Method Details

#frameObject



7
8
9
# File 'lib/ws_light/set/random_set.rb', line 7

def frame
  @set ||= generate_set
end

#generate_setObject



15
16
17
18
19
20
21
# File 'lib/ws_light/set/random_set.rb', line 15

def generate_set
  set = []
  @full_length.times do
    set << Color.random
  end
  set
end

#pixel(number, _frame = 0) ⇒ Object



11
12
13
# File 'lib/ws_light/set/random_set.rb', line 11

def pixel(number, _frame = 0)
  frame[number]
end