Class: QDA::Version
- Inherits:
-
Object
- Object
- QDA::Version
- Defined in:
- lib/weft/application.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(str) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(str) ⇒ Version
Returns a new instance of Version.
8 9 10 11 12 13 14 |
# File 'lib/weft/application.rb', line 8 def initialize(str) if str =~ /(\d+)\.(\d+)\.(\d+)\s*/ @major, @minor, @release = $1, $2, $3 else raise ArgumentError.new("Invalid version string #{str}") end end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
3 4 5 |
# File 'lib/weft/application.rb', line 3 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
3 4 5 |
# File 'lib/weft/application.rb', line 3 def minor @minor end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
3 4 5 |
# File 'lib/weft/application.rb', line 3 def release @release end |
Class Method Details
.default_version ⇒ Object
4 5 6 |
# File 'lib/weft/application.rb', line 4 def Version.default_version() self.new('0.0.0') end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/weft/application.rb', line 20 def ==(other) if other.kind_of?(String) other = Version.new(other) end self.major == other.major && self.minor == other.minor && self.release == other.release end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/weft/application.rb', line 16 def to_s [@major, @minor, @release].join('.') end |