Class: Cul::Image::Properties::Exif::IFD_Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/cul_image_props/image/properties/exif/types.rb

Overview

for ease of dealing with tags

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(printable, tag, field_type, values, field_offset, field_length) ⇒ IFD_Tag

Returns a new instance of IFD_Tag.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 76

def initialize( printable, tag, field_type, values, field_offset, field_length)
    # printable version of data
    @printable = printable
    # tag ID number
    @tag = tag
    # field type as index into FIELD_TYPES
    @field_type = field_type
    # offset of start of field in bytes from beginning of IFD
    @field_offset = field_offset
    # length of data field in bytes
    @field_length = field_length
    # either a string or array of data items
    @values = values
end

Instance Attribute Details

#field_lengthObject

Returns the value of attribute field_length.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def field_length
  @field_length
end

#field_offsetObject

Returns the value of attribute field_offset.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def field_offset
  @field_offset
end

#field_typeObject

Returns the value of attribute field_type.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def field_type
  @field_type
end

#printableObject

Returns the value of attribute printable.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def printable
  @printable
end

#tagObject

Returns the value of attribute tag.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def tag
  @tag
end

#valuesObject

Returns the value of attribute values.



75
76
77
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 75

def values
  @values
end

Instance Method Details

#inspectObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 95

def inspect
    begin
        s= format("(0x%04X) %s=%s @ %d", @tag,
                                    FIELD_TYPES[@field_type][2],
                                    @printable,
                                    @field_offset)
    rescue
        s= format("(%s) %s=%s @ %s", @tag.to_s,
                                    FIELD_TYPES[@field_type][2],
                                    @printable,
                                    @field_offset.to_s)
    end
    return s
end

#to_sObject



91
92
93
# File 'lib/cul_image_props/image/properties/exif/types.rb', line 91

def to_s
    return @printable
end