Class: ZPNG::Metadata

Inherits:
Array
  • Object
show all
Defined in:
lib/zpng/metadata.rb

Instance Method Summary collapse

Constructor Details

#initialize(img = nil) ⇒ Metadata

Returns a new instance of Metadata.



3
4
5
6
7
8
9
# File 'lib/zpng/metadata.rb', line 3

def initialize img = nil
  return unless img
  img.chunks.each do |c|
    next unless c.is_a?(TextChunk)
    self << [c.keyword, c.text, c.to_hash]
  end
end

Instance Method Details

#[](*args) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/zpng/metadata.rb', line 11

def [] *args
  if args.first.is_a?(String)
    each{ |a| return a[1] if a[0] == args.first }
    nil
  else
    super
  end
end