Class: PREP::Core::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/core/color.rb

Overview

nodoc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(red, green, blue) ⇒ Color

Returns a new instance of Color.



11
12
13
14
15
# File 'lib/core/color.rb', line 11

def initialize(red, green, blue)
  self.red = red
  self.green = green
  self.blue = blue
end

Instance Attribute Details

#blueObject

Returns the value of attribute blue.



9
10
11
# File 'lib/core/color.rb', line 9

def blue
  @blue
end

#greenObject

Returns the value of attribute green.



9
10
11
# File 'lib/core/color.rb', line 9

def green
  @green
end

#redObject

Returns the value of attribute red.



9
10
11
# File 'lib/core/color.rb', line 9

def red
  @red
end

Instance Method Details

#white?Boolean

全ての色設定が 255 の場合は白として扱う

Returns:

  • (Boolean)


18
19
20
# File 'lib/core/color.rb', line 18

def white?
  return red == 1.0 && green == 1.0 && blue == 1.0
end