Class: Ea::Qea::Models::EaImage

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ea/qea/models/ea_image.rb

Overview

Raw-row model for t_image. EA stores pasted images as EMF (Enhanced Metafile) blobs in this table.

type values observed in real QEAs:

- "ENHMetafile" — Enhanced Windows Metafile (most common)
- "Metafile"    — Old-style WMF
- "Bitmap"      — DIB / PNG bitmap

Constant Summary collapse

COLUMN_MAP =
{
  "ImageID" => :image_id
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key, #sort_position

Class Method Details

.column_mapObject



31
32
33
# File 'lib/ea/qea/models/ea_image.rb', line 31

def self.column_map
  COLUMN_MAP
end

.primary_key_columnObject



19
20
21
# File 'lib/ea/qea/models/ea_image.rb', line 19

def self.primary_key_column
  :image_id
end

.table_nameObject



23
24
25
# File 'lib/ea/qea/models/ea_image.rb', line 23

def self.table_name
  "t_image"
end

Instance Method Details

#bytesString?

Raw image bytes. SQLite returns BLOB as ASCII-8BIT String.

Returns:

  • (String, nil)

    binary string



47
48
49
# File 'lib/ea/qea/models/ea_image.rb', line 47

def bytes
  image
end

#emf?Boolean

Returns true when this row holds an EMF blob.

Returns:

  • (Boolean)

    true when this row holds an EMF blob



36
37
38
# File 'lib/ea/qea/models/ea_image.rb', line 36

def emf?
  type&.casecmp?("ENHMetafile")
end

#wmf?Boolean

Returns true when this row holds a WMF blob.

Returns:

  • (Boolean)

    true when this row holds a WMF blob



41
42
43
# File 'lib/ea/qea/models/ea_image.rb', line 41

def wmf?
  type&.casecmp?("Metafile")
end