Class: RightScraper::Scanners::CookbookManifest

Inherits:
Base
  • Object
show all
Defined in:
lib/right_scraper/scanners/cookbook_manifest.rb

Overview

Build manifests from a filesystem.

Instance Method Summary collapse

Methods inherited from Base

#begin, #finish, #notice_dir

Constructor Details

#initialize(*args) ⇒ CookbookManifest

Create a new manifest scanner. Does not accept any new arguments.



34
35
36
37
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 34

def initialize(*args)
  super
  @manifest = {}
end

Instance Method Details

#end(resource) ⇒ Object

Complete a scan for the given resource.

Parameters ===

resource(RightScraper::Resources::Base)

resource to scan



43
44
45
46
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 43

def end(resource)
  resource.manifest = @manifest
  @manifest = {}
end

#notice(relative_position) ⇒ 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 file from root of resource



56
57
58
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 56

def notice(relative_position)
  @manifest[relative_position] = Digest::MD5.hexdigest(yield)
end