Class: Darcs::Patch
- Inherits:
-
Object
- Object
- Darcs::Patch
- Defined in:
- lib/darcs/repository.rb
Overview
A Patch is the full representation of a patch file in a repository (PatchInfo is simply the inventory information).
Patch acts as an aggregate of PatchInfo
Instance Attribute Summary collapse
-
#info ⇒ Object
Returns the value of attribute info.
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
-
#filename ⇒ Object
Retrieves the full path to the patch file.
-
#initialize(repository, info) ⇒ Patch
constructor
A new instance of Patch.
- #method_missing(*args) ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(repository, info) ⇒ Patch
Returns a new instance of Patch.
99 100 101 102 |
# File 'lib/darcs/repository.rb', line 99 def initialize(repository, info) @repository = repository @info = info end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
104 105 106 |
# File 'lib/darcs/repository.rb', line 104 def method_missing(*args) info.send(*args) end |
Instance Attribute Details
#info ⇒ Object
Returns the value of attribute info.
97 98 99 |
# File 'lib/darcs/repository.rb', line 97 def info @info end |
#repository ⇒ Object
Returns the value of attribute repository.
97 98 99 |
# File 'lib/darcs/repository.rb', line 97 def repository @repository end |
Instance Method Details
#filename ⇒ Object
Retrieves the full path to the patch file
109 110 111 |
# File 'lib/darcs/repository.rb', line 109 def filename File.join(repository.path,'_darcs','patches',info.filename) end |
#write ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/darcs/repository.rb', line 113 def write patch_writer = PatchWriter.new(self) begin yield patch_writer patch_writer.finish File.open(repository.inventory_file, 'a') do |inv| inv.write(info.to_s + "\n") end rescue patch_writer.abort raise $! end end |