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.



32
33
34
35
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 32

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



41
42
43
44
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 41

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



54
55
56
# File 'lib/right_scraper/scanners/cookbook_manifest.rb', line 54

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