Class: OpenUSD::MetadataView
- Inherits:
-
Hash
- Object
- Hash
- OpenUSD::MetadataView
- Defined in:
- lib/openusd/metadata_view.rb
Overview
Hash-compatible composed metadata that authors mutations through a callback.
Instance Method Summary collapse
-
#[]=(key, value) ⇒ Object
Author a metadata value through the owning view.
-
#delete(key) ⇒ Object
Delete an authored metadata value.
-
#initialize(values, writer:) ⇒ MetadataView
constructor
A new instance of MetadataView.
Constructor Details
#initialize(values, writer:) ⇒ MetadataView
Returns a new instance of MetadataView.
6 7 8 9 10 |
# File 'lib/openusd/metadata_view.rb', line 6 def initialize(values, writer:) super() values.each { |key, value| store(key.to_s, value) } @writer = writer end |
Instance Method Details
#[]=(key, value) ⇒ Object
Author a metadata value through the owning view.
13 14 15 16 17 |
# File 'lib/openusd/metadata_view.rb', line 13 def []=(key, value) normalized = key.to_s @writer.call(:set, normalized, value) store(normalized, value) end |
#delete(key) ⇒ Object
Delete an authored metadata value.
20 21 22 23 24 |
# File 'lib/openusd/metadata_view.rb', line 20 def delete(key) normalized = key.to_s @writer.call(:delete, normalized, nil) super(normalized) end |