Module: IMW::Metadata::ContainsMetadata
- Included in:
- Schemes::Local::LocalDirectory
- Defined in:
- lib/imw/metadata/contains_metadata.rb
Overview
A module that can be mixed into any class defining a contents methods which returns an Array of URI strings.
Instance Attribute Summary collapse
-
#metadata ⇒ IMW::Metadata?
Return the metadata for this resource.
-
#metadata_uri ⇒ String?
The path at which this resource’s metadata file lives.
Instance Method Summary collapse
-
#metadata? ⇒ true, false
Does this resource contain metadata for other resources it contains?.
Instance Attribute Details
#metadata ⇒ IMW::Metadata?
Return the metadata for this resource.
33 34 35 |
# File 'lib/imw/metadata/contains_metadata.rb', line 33 def ||= && IMW::Metadata.load() end |
#metadata_uri ⇒ String?
The path at which this resource’s metadata file lives.
Will default to any file beginning with metadata and ending with a yaml or json extension contained in this resource’s contents.
15 16 17 |
# File 'lib/imw/metadata/contains_metadata.rb', line 15 def ||= contents.detect { |path| path =~ /metadata.*\.(ya?ml|json)$/ } end |
Instance Method Details
#metadata? ⇒ true, false
Does this resource contain metadata for other resources it contains?
26 27 28 |
# File 'lib/imw/metadata/contains_metadata.rb', line 26 def (!! ) end |