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: nil, default_encoding: nil) ⇒ IPTC



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

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

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



20
21
22
# File 'lib/iptcr/iptc.rb', line 20

def fields
  @fields
end

Instance Method Details

#[](name) ⇒ Object



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

def [](name)
  field_values[name]
end

#encodingObject



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

def encoding
  @encoding || DEFAULT_ENCODING
end

#to_hashObject



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

def to_hash
  field_values
end