Class: SVNx::Revision::Range

Inherits:
Object
  • Object
show all
Includes:
Logue::Loggable
Defined in:
lib/svnx/revision/range.rb

Overview

this is of the form: -r123:456

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to = nil, entries = nil) ⇒ Range

Returns a new instance of Range.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/svnx/revision/range.rb', line 18

def initialize from, to = nil, entries = nil
  if to
    @from = to_revision from, entries
    @to = to_revision to, entries
  elsif from.kind_of? String
    @from, @to = from.split(':').collect { |x| to_revision x, entries }
  else
    @from = to_revision from, entries
    @to = :working_copy
  end
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



15
16
17
# File 'lib/svnx/revision/range.rb', line 15

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



16
17
18
# File 'lib/svnx/revision/range.rb', line 16

def to
  @to
end

Instance Method Details

#head?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/svnx/revision/range.rb', line 42

def head?
  @to && @to.value == 'HEAD'
end

#to_revision(val, entries) ⇒ Object



30
31
32
# File 'lib/svnx/revision/range.rb', line 30

def to_revision val, entries
  val.kind_of?(Argument) ? val : Argument.create(val, entries: entries)
end

#to_sObject



34
35
36
37
38
39
40
# File 'lib/svnx/revision/range.rb', line 34

def to_s
  str = @from.to_s
  unless working_copy?
    str << ':' << @to.to_s
  end
  str
end

#working_copy?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/svnx/revision/range.rb', line 46

def working_copy?
  @to == nil || @to == :wc || @to == :working_copy
end