Class: ZPNG::Pixels

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/zpng/pixels.rb

Defined Under Namespace

Modules: ImageEnum, ScanLineEnum

Instance Method Summary collapse

Constructor Details

#initialize(x) ⇒ Pixels

Returns a new instance of Pixels.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/zpng/pixels.rb', line 40

def initialize x
  case x
  when Image
    @image = x
    extend ImageEnum
  when ScanLine
    @scanline = x
    extend ScanLineEnum
  else raise ArgumentError, "don't know how to enumerate #{x.inspect}"
  end
end

Instance Method Details

#==(other) ⇒ Object



52
53
54
# File 'lib/zpng/pixels.rb', line 52

def == other
  self.to_a == other.to_a
end

#uniqObject



56
57
58
# File 'lib/zpng/pixels.rb', line 56

def uniq
  self.to_a.uniq
end