Class: PVN::Diff::Path

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

that’s the root url



21
22
23
24
25
26
27
28
# File 'lib/pvn/diff/path.rb', line 21

def initialize name, revision, action, url
  @name = name
  @revisions = Array.new
  @path_revisions = Array.new
  add_revision revision, action
  @action = action.kind_of?(SVNx::Action) || SVNx::Action.new(action)
  @url = url
end

Instance Attribute Details

#actionObject (readonly)

attr_reader :revisions



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

def action
  @action
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#path_revisionsObject (readonly)

$$$ this will be renamed revisions, when the old one is gone.



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

def path_revisions
  @path_revisions
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#add_revision(rev, action) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/pvn/diff/path.rb', line 30

def add_revision rev, action
  info "rev: #{rev}".on_green
  if rev.kind_of?(Array)
    rev.each do |rv|
      @revisions << to_revision(rv)
    end
  else
    @revisions << to_revision(rev)
  end
  @path_revisions << PathRevision.new(to_revision(rev), action)
end

#to_revision(rev) ⇒ Object



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

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



48
49
50
# File 'lib/pvn/diff/path.rb', line 48

def to_s
  inspect
end