Class: ZPNG::BMP::BmpPseudoChunk

Inherits:
Chunk
  • Object
show all
Defined in:
lib/zpng/bmp/reader.rb

Instance Attribute Summary

Attributes inherited from Chunk

#crc, #data, #idx, #size, #type

Instance Method Summary collapse

Methods inherited from Chunk

#crc_ok?, #export, #export_data, #fix_crc!, from_stream

Methods included from DeepCopyable

#deep_copy

Constructor Details

#initialize(struct) ⇒ BmpPseudoChunk

Returns a new instance of BmpPseudoChunk.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/zpng/bmp/reader.rb', line 75

def initialize struct
  @struct = struct
  type =
    if struct.respond_to?(:type)
      struct.type
    else
      struct.class.to_s.split('::').last
    end

  super(
    #:size    => struct.class.const_get('SIZE'),
    :type    => type,
    :data    => struct.pack,
    :crc     => :no_crc               # for CLI
  )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mname, *args) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/zpng/bmp/reader.rb', line 94

def method_missing mname, *args
  if @struct.respond_to?(mname)
    @struct.send(mname,*args)
  else
    super
  end
end

Instance Method Details

#inspect(*args) ⇒ Object



91
92
93
# File 'lib/zpng/bmp/reader.rb', line 91

def inspect *args
  @struct.inspect
end