Class: SVNx::Revision::Range
- Inherits:
-
Object
- Object
- SVNx::Revision::Range
- Includes:
- Logue::Loggable
- Defined in:
- lib/svnx/revision/range.rb
Overview
this is of the form: -r123:456
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #head? ⇒ Boolean
-
#initialize(from, to = nil, entries = nil) ⇒ Range
constructor
A new instance of Range.
- #to_revision(val, entries) ⇒ Object
- #to_s ⇒ Object
- #working_copy? ⇒ Boolean
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
#from ⇒ Object (readonly)
Returns the value of attribute from.
15 16 17 |
# File 'lib/svnx/revision/range.rb', line 15 def from @from end |
#to ⇒ Object (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
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_s ⇒ Object
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
46 47 48 |
# File 'lib/svnx/revision/range.rb', line 46 def working_copy? @to == nil || @to == :wc || @to == :working_copy end |