Class: Perforce2Svn::VersionRange
- Inherits:
-
Object
- Object
- Perforce2Svn::VersionRange
- Defined in:
- lib/perforce2svn/version_range.rb
Overview
Represents the version range that is supposed to be migrated
Instance Attribute Summary collapse
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(min, max = -1)) ⇒ VersionRange
constructor
A new instance of VersionRange.
- #reset_to_head(head) ⇒ Object
- #synced_to_head? ⇒ Boolean
Constructor Details
#initialize(min, max = -1)) ⇒ VersionRange
Returns a new instance of VersionRange.
8 9 10 11 |
# File 'lib/perforce2svn/version_range.rb', line 8 def initialize(min, max=-1) @min = min @max = max end |
Instance Attribute Details
#max ⇒ Object (readonly)
Returns the value of attribute max.
6 7 8 |
# File 'lib/perforce2svn/version_range.rb', line 6 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
6 7 8 |
# File 'lib/perforce2svn/version_range.rb', line 6 def min @min end |
Class Method Details
.build(versions) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/perforce2svn/version_range.rb', line 21 def VersionRange.build(versions) if versions =~ /^(\d+):(HEAD|\d+)$/ min = $1.to_i if $2 == "HEAD" max = -1 else max = $2.to_i if max < 1 raise Choosy::ValidationError, "Maximum change revision cannot be less than 1: #{versions}" end end if min < 1 raise Choosy::ValidationError, "Minimum change revision cannot be less than 1: #{versions}" end return VersionRange.new(min, max) else raise Choosy::ValidationError, "Missing or malformed argument for '--changes': #{versions}" end end |
Instance Method Details
#reset_to_head(head) ⇒ Object
13 14 15 |
# File 'lib/perforce2svn/version_range.rb', line 13 def reset_to_head(head) @max = head end |
#synced_to_head? ⇒ Boolean
17 18 19 |
# File 'lib/perforce2svn/version_range.rb', line 17 def synced_to_head? @max == -1 end |