Class: IPTCR::IPTC

Inherits:
Object
  • Object
show all
Defined in:
lib/iptcr/iptc.rb

Overview

# IPTC

## Notes

IPTC metadata is a series of records. Records contain datasets. Each dataset contains a data field, which is a particular value for that dataset. Repeated datasets represent mulitple fields for the same dataset, like for list data.

## References

Defined Under Namespace

Classes: Field

Constant Summary collapse

DEFAULT_ENCODING =

IPTC IIM specifics the default encoding is ISO646/4873, which is roughly ASCII

Encoding::ASCII

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, length:) ⇒ IPTC

Returns a new instance of IPTC.



27
28
29
30
# File 'lib/iptcr/iptc.rb', line 27

def initialize(io, length:)
  @fields = []
  read_fields(io, length: length)
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



22
23
24
# File 'lib/iptcr/iptc.rb', line 22

def fields
  @fields
end

Instance Method Details

#[](name) ⇒ Object



36
37
38
# File 'lib/iptcr/iptc.rb', line 36

def [](name)
  field_values[name]
end

#encodingObject



32
33
34
# File 'lib/iptcr/iptc.rb', line 32

def encoding
  @encoding || DEFAULT_ENCODING
end

#to_hashObject



40
41
42
# File 'lib/iptcr/iptc.rb', line 40

def to_hash
  field_values
end