Class: Aardi::ContentHashes
- Inherits:
-
Object
- Object
- Aardi::ContentHashes
- Defined in:
- lib/aardi/content_hashes.rb
Instance Method Summary collapse
- #[](path) ⇒ Object
- #[]=(path, hash) ⇒ Object
-
#initialize(path) ⇒ ContentHashes
constructor
A new instance of ContentHashes.
- #write ⇒ Object
Constructor Details
#initialize(path) ⇒ ContentHashes
Returns a new instance of ContentHashes.
5 6 7 8 |
# File 'lib/aardi/content_hashes.rb', line 5 def initialize(path) @path = path read_hashes end |
Instance Method Details
#[](path) ⇒ Object
10 11 12 |
# File 'lib/aardi/content_hashes.rb', line 10 def [](path) @hashes[path] end |
#[]=(path, hash) ⇒ Object
14 15 16 |
# File 'lib/aardi/content_hashes.rb', line 14 def []=(path, hash) @hashes[path] = hash end |
#write ⇒ Object
18 19 20 21 22 23 |
# File 'lib/aardi/content_hashes.rb', line 18 def write return if new_hashes == @original_hashes File.write(@path, @new_hashes) puts "Wrote: #{@path}\n" end |