Class: RightScraper::Scanners::CookbookMetadataReadOnly

Inherits:
CookbookMetadata show all
Defined in:
lib/right_scraper/scanners/cookbook_metadata_readonly.rb

Overview

Loads existing cookbook metadata from a filesystem.

Constant Summary

Constants inherited from CookbookMetadata

RightScraper::Scanners::CookbookMetadata::FREED_FILE_SIZE_CONSTRAINT, RightScraper::Scanners::CookbookMetadata::JAILED_FILE_SIZE_CONSTRAINT, RightScraper::Scanners::CookbookMetadata::JSON_METADATA, RightScraper::Scanners::CookbookMetadata::KNIFE_METADATA_SCRIPT_NAME, RightScraper::Scanners::CookbookMetadata::RUBY_METADATA, RightScraper::Scanners::CookbookMetadata::UNDEFINED_COOKBOOK_NAME

Instance Attribute Summary

Attributes inherited from CookbookMetadata

#freed_dir

Instance Method Summary collapse

Methods inherited from CookbookMetadata

#begin, #end, #finish, #initialize, #notice_dir, #tls

Methods inherited from Base

#begin, #end, #finish, #initialize, #notice_dir

Constructor Details

This class inherits a constructor from RightScraper::Scanners::CookbookMetadata

Instance Method Details

#notice(relative_position, &blk) ⇒ Object

Notice a file during scanning.

Block

Return the data for this file. We use a block because it may not always be necessary to read the data.

Parameters

relative_position(String)

relative pathname for the file from root of cookbook



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/right_scraper/scanners/cookbook_metadata_readonly.rb', line 40

def notice(relative_position, &blk)
  case relative_position
  when 
    # preferred over RUBY_METADATA.
    @read_blk = blk
  when 
    # defer to any JSON_METADATA, which we hope refers to the same info.
    @read_blk ||= self.method(:generated_metadata_json_readonly)
  end
  true
end