Class: IPTCR::IPTC
- Inherits:
-
Object
- Object
- IPTCR::IPTC
- 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
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #encoding ⇒ Object
-
#initialize(io, length: nil, default_encoding: nil) ⇒ IPTC
constructor
A new instance of IPTC.
- #to_hash ⇒ Object
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
#fields ⇒ Object (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 |
#encoding ⇒ Object
31 32 33 |
# File 'lib/iptcr/iptc.rb', line 31 def encoding @encoding || DEFAULT_ENCODING end |
#to_hash ⇒ Object
39 40 41 |
# File 'lib/iptcr/iptc.rb', line 39 def to_hash field_values end |