Class: PVN::Diff::Paths
- Inherits:
-
Object
- Object
- PVN::Diff::Paths
- Includes:
- Enumerable, Logue::Loggable
- Defined in:
- lib/pvn/diff/paths.rb
Overview
represents the paths from one revision through another.
Direct Known Subclasses
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #add_for_path(path) ⇒ Object
- #each(&blk) ⇒ Object
-
#initialize(revision, paths) ⇒ Paths
constructor
takes paths of the form “.”, “foo.rb”, etc.
- #size ⇒ Object
-
#to_map ⇒ Object
returns a map from names to logpaths.
Constructor Details
#initialize(revision, paths) ⇒ Paths
takes paths of the form “.”, “foo.rb”, etc.
13 14 15 16 17 18 19 20 |
# File 'lib/pvn/diff/paths.rb', line 13 def initialize revision, paths @revision = revision @elements = SortedSet.new paths.each do |path| add_for_path path end end |
Instance Method Details
#[](idx) ⇒ Object
26 27 28 |
# File 'lib/pvn/diff/paths.rb', line 26 def [] idx @elements.to_a[idx] end |
#add_for_path(path) ⇒ Object
22 23 24 |
# File 'lib/pvn/diff/paths.rb', line 22 def add_for_path path raise "implement this" end |
#each(&blk) ⇒ Object
41 42 43 |
# File 'lib/pvn/diff/paths.rb', line 41 def each(&blk) @elements.each(&blk) end |
#size ⇒ Object
30 31 32 |
# File 'lib/pvn/diff/paths.rb', line 30 def size @elements.size end |
#to_map ⇒ Object
returns a map from names to logpaths
35 36 37 38 39 |
# File 'lib/pvn/diff/paths.rb', line 35 def to_map names_to_paths = Hash.new @elements.each { |path| names_to_paths[path.name] = path } names_to_paths end |