Class: RightScraper::Resources::Cookbook
- Inherits:
-
Base
- Object
- Base
- RightScraper::Resources::Cookbook
show all
- Defined in:
- lib/right_scraper/resources/cookbook.rb
Constant Summary
collapse
- EMPTY_MANIFEST_JSON =
::JSON.dump(:manifest => {}).freeze
Instance Attribute Summary
Attributes inherited from Base
#manifest, #metadata, #pos, #repository
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#manifest=(value) ⇒ Object
36
37
38
39
40
|
# File 'lib/right_scraper/resources/cookbook.rb', line 36
def manifest=(value)
@manifest_json = nil
@resource_hash = nil
@manifest = value
end
|
#manifest_json ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/right_scraper/resources/cookbook.rb', line 42
def manifest_json
unless @manifest_json
if manifest && !manifest.empty?
manifest_hash = { :manifest => manifest }
@manifest_json = ::RightSupport::Data::HashTools.deep_sorted_json(manifest_hash, pretty=true).freeze
else
@manifest_json = EMPTY_MANIFEST_JSON
end
end
@manifest_json
end
|
#resource_hash ⇒ Object
56
57
58
59
60
61
|
# File 'lib/right_scraper/resources/cookbook.rb', line 56
def resource_hash
unless @resource_hash
@resource_hash = ::Digest::MD5.hexdigest(manifest_json).freeze
end
@resource_hash
end
|