Class: PVN::Revision::Range
- Inherits:
-
Object
- Object
- PVN::Revision::Range
- Includes:
- Loggable
- Defined in:
- lib/pvn/revision/range.rb
Overview
this is of the form: -r123:456
Direct Known Subclasses
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, xmllines = nil) ⇒ Range
constructor
A new instance of Range.
- #to_revision(val, xmllines) ⇒ Object
- #to_s ⇒ Object
- #working_copy? ⇒ Boolean
Constructor Details
#initialize(from, to = nil, xmllines = nil) ⇒ Range
Returns a new instance of Range.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pvn/revision/range.rb', line 17 def initialize from, to = nil, xmllines = nil if to @from = to_revision from, xmllines @to = to_revision to, xmllines elsif from.kind_of? String @from, @to = from.split(':').collect { |x| to_revision x, xmllines } else @from = to_revision from, xmllines @to = :working_copy end end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
14 15 16 |
# File 'lib/pvn/revision/range.rb', line 14 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
15 16 17 |
# File 'lib/pvn/revision/range.rb', line 15 def to @to end |
Instance Method Details
#head? ⇒ Boolean
41 42 43 |
# File 'lib/pvn/revision/range.rb', line 41 def head? @to == :head end |
#to_revision(val, xmllines) ⇒ Object
29 30 31 |
# File 'lib/pvn/revision/range.rb', line 29 def to_revision val, xmllines val.kind_of?(Argument) || Argument.new(val, xmllines) end |
#to_s ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/pvn/revision/range.rb', line 33 def to_s str = @from.to_s unless working_copy? str << ':' << @to.to_s end str end |
#working_copy? ⇒ Boolean
45 46 47 |
# File 'lib/pvn/revision/range.rb', line 45 def working_copy? @to == nil || @to == :wc || @to == :working_copy end |