Class: ZIMG::Pixels

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

Defined Under Namespace

Modules: ImageEnum, ScanLineEnum

Instance Method Summary collapse

Constructor Details

#initialize(x) ⇒ Pixels

Returns a new instance of Pixels.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/zimg/pixels.rb', line 42

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



54
55
56
# File 'lib/zimg/pixels.rb', line 54

def ==(other)
  to_a == other.to_a
end

#uniqObject



58
59
60
# File 'lib/zimg/pixels.rb', line 58

def uniq
  to_a.uniq
end