Class: Jpeg::Color

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bObject

Returns the value of attribute b

Returns:

  • (Object)

    the current value of b



2
3
4
# File 'lib/jpeg/color.rb', line 2

def b
  @b
end

#gObject

Returns the value of attribute g

Returns:

  • (Object)

    the current value of g



2
3
4
# File 'lib/jpeg/color.rb', line 2

def g
  @g
end

#rObject

Returns the value of attribute r

Returns:

  • (Object)

    the current value of r



2
3
4
# File 'lib/jpeg/color.rb', line 2

def r
  @r
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/jpeg/color.rb', line 12

def inspect
  format '<Jpeg::Color r=0x%02x g=0x%02x b=0x%02x>', *rgb
end

#rgbObject Also known as: to_a



3
4
5
# File 'lib/jpeg/color.rb', line 3

def rgb
  [r, g, b]
end

#to_sObject



8
9
10
# File 'lib/jpeg/color.rb', line 8

def to_s
  format '#%02x%02x%02x', *rgb
end