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

Instance Method Summary collapse

Instance Attribute Details

#metadataIMW::Metadata?

Return the metadata for this resource.

Returns:



33
34
35
# File 'lib/imw/metadata/contains_metadata.rb', line 33

def 
   ||= metadata? && IMW::.load()
end

#metadata_uriString?

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.

Returns:



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?

Returns:

  • (true, false)


26
27
28
# File 'lib/imw/metadata/contains_metadata.rb', line 26

def metadata?
  (!! )
end