Class: PVN::Diff::Path

Inherits:
Object
  • Object
show all
Includes:
Logue::Loggable
Defined in:
lib/pvn/diff/path.rb

Direct Known Subclasses

LocalPath, LogPath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, revision, action, url) ⇒ Path

that’s the root url



18
19
20
21
22
23
# File 'lib/pvn/diff/path.rb', line 18

def initialize name, revision, action, url
  @name = name
  @changes = Array.new
  add_change revision, action
  @url = url
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



15
16
17
# File 'lib/pvn/diff/path.rb', line 15

def changes
  @changes
end

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/pvn/diff/path.rb', line 13

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



14
15
16
# File 'lib/pvn/diff/path.rb', line 14

def url
  @url
end

Instance Method Details

#<=>(other) ⇒ Object



44
45
46
# File 'lib/pvn/diff/path.rb', line 44

def <=> other
  name <=> other.name
end

#add_change(rev, action) ⇒ Object



25
26
27
# File 'lib/pvn/diff/path.rb', line 25

def add_change rev, action
  @changes << Change.new(to_revision(rev), action)
end

#run_diff(displaypath, fromlines, fromrev, tolines, torev, whitespace) ⇒ Object



35
36
37
38
# File 'lib/pvn/diff/path.rb', line 35

def run_diff displaypath, fromlines, fromrev, tolines, torev, whitespace
  ds = DiffSet.new displaypath, fromlines, fromrev, tolines, torev, whitespace
  ds.run_diff
end

#to_revision(rev) ⇒ Object



29
30
31
32
33
# File 'lib/pvn/diff/path.rb', line 29

def to_revision rev
  # or should we convert this to Revision::Argument, and @revisions is
  # Revision::Range?
  rev.kind_of?(Fixnum) ? rev.to_s : rev
end

#to_sObject



40
41
42
# File 'lib/pvn/diff/path.rb', line 40

def to_s
  "#{name}; #{url}"
end