Class: Amp::ManifestEntry
Instance Method Summary collapse
-
#clone ⇒ Object
(also: #dup)
Clones the dictionary.
- #delete(*args) ⇒ Object
- #files ⇒ Object
- #flags(file = nil) ⇒ Object
-
#initialize(mapping = nil, flags = nil) ⇒ ManifestEntry
constructor
Initializes the dictionary.
- #inspect ⇒ Object
-
#mark_for_later(file, node) ⇒ Object
Mark a file to be checked later on.
Methods inherited from Hash
Constructor Details
#initialize(mapping = nil, flags = nil) ⇒ ManifestEntry
Initializes the dictionary. It can be empty, by initializing with no arguments, or with more data by assigning them.
It is a hash of Filename => node_id
13 14 15 16 17 |
# File 'lib/amp/revlogs/manifest.rb', line 13 def initialize(mapping=nil, flags=nil) @source_hash = mapping || {} super(@source_hash || {}) @flags = flags || {} end |
Instance Method Details
#clone ⇒ Object Also known as: dup
Clones the dictionary
37 38 39 |
# File 'lib/amp/revlogs/manifest.rb', line 37 def clone self.class.new @source_hash.dup, @flags.dup end |
#delete(*args) ⇒ Object
30 31 32 33 |
# File 'lib/amp/revlogs/manifest.rb', line 30 def delete(*args) super(*args) flags.delete(*args) end |
#files ⇒ Object
28 |
# File 'lib/amp/revlogs/manifest.rb', line 28 def files; keys; end |
#flags(file = nil) ⇒ Object
24 25 26 |
# File 'lib/amp/revlogs/manifest.rb', line 24 def flags(file=nil) file ? @flags[file] : @flags end |
#inspect ⇒ Object
19 20 21 22 |
# File 'lib/amp/revlogs/manifest.rb', line 19 def inspect "#<ManifestEntry " + @source_hash.inspect + "\n" + " " + @flags.inspect + ">" end |
#mark_for_later(file, node) ⇒ Object
Mark a file to be checked later on
49 50 51 52 |
# File 'lib/amp/revlogs/manifest.rb', line 49 def mark_for_later(file, node) self[file] = nil # notice how we DIDN'T use `self.delete file` flags[file] = node.flags file end |