lib/scrivito/basic_obj.rb in scrivito_sdk-0.71.2 vs lib/scrivito/basic_obj.rb in scrivito_sdk-0.90.0.rc1
- old
+ new
@@ -792,9 +792,24 @@
# @return [String, nil]
def binary_url
binary.try(:url)
end
+ # @api public
+ #
+ # Allows accessing the meta data for binary +Objs+.
+ #
+ # @example Accessing meta data
+ # obj.meta_data['width'] # => 150
+ # obj.meta_data['content_type'] # => 'image/jpeg'
+ #
+ # @see Scrivito::MetaDataCollection List of available meta data attributes.
+ #
+ # @return [Scrivito::MetaDataCollection] The collection of available meta data
+ def meta_data
+ binary.try(:meta_data) || MetaDataCollection.new({})
+ end
+
def body_length
raise %(
The method `body_length' was removed. Please use
`binary_length' or `body.length' instead
)