Class: Babeltrace2::BTVersion::Number
- Inherits:
-
Object
- Object
- Babeltrace2::BTVersion::Number
- Includes:
- Comparable
- Defined in:
- lib/babeltrace2/version.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
readonly
Returns the value of attribute extra.
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(major, minor, patch, extra = nil) ⇒ Number
constructor
A new instance of Number.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(major, minor, patch, extra = nil) ⇒ Number
Returns a new instance of Number.
47 48 49 50 51 52 |
# File 'lib/babeltrace2/version.rb', line 47 def initialize(major, minor, patch, extra = nil) @major = major @minor = minor @patch = patch @extra = extra end |
Instance Attribute Details
#extra ⇒ Object (readonly)
Returns the value of attribute extra.
46 47 48 |
# File 'lib/babeltrace2/version.rb', line 46 def extra @extra end |
#major ⇒ Object (readonly)
Returns the value of attribute major.
46 47 48 |
# File 'lib/babeltrace2/version.rb', line 46 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
46 47 48 |
# File 'lib/babeltrace2/version.rb', line 46 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
46 47 48 |
# File 'lib/babeltrace2/version.rb', line 46 def patch @patch end |
Instance Method Details
#<=>(other) ⇒ Object
64 65 66 |
# File 'lib/babeltrace2/version.rb', line 64 def <=>(other) to_a <=> other.to_a end |
#to_a ⇒ Object
60 61 62 |
# File 'lib/babeltrace2/version.rb', line 60 def to_a [@major, @minor, @patch] end |
#to_s ⇒ Object
54 55 56 57 58 |
# File 'lib/babeltrace2/version.rb', line 54 def to_s str = "#{@major}.#{@minor}.#{@patch}" str << " (#{extra})" if extra str end |