Class: CineSync::RGBArray

Inherits:
Array
  • Object
show all
Defined in:
lib/cinesync/color_grading.rb

Direct Known Subclasses

BrightnessArray

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object

Implements an array of three values (corresponding to red, green, and blue) that can be indexed by position or string-convertible object:

r,g,b = rgbary[0], rgbary[1], rgbary[2]
r,g,b = rgbary['red'], rgbary[:green], rgbary[:b]


39
40
41
42
43
# File 'lib/cinesync/color_grading.rb', line 39

def [](key)
  index = index_for_key(key)
  fail "Unknown key used to index #{self.class}: #{key.inspect}" unless index
  self.at(index)
end

#[]=(key, value) ⇒ Object



45
46
47
48
49
# File 'lib/cinesync/color_grading.rb', line 45

def []=(key, value)
  index = index_for_key(key)
  fail "Unknown key used to index #{self.class}: #{key.inspect}" unless index
  super(index, value)
end