Class: GemFresh::GemVersion
- Inherits:
-
Object
- Object
- GemFresh::GemVersion
- Defined in:
- lib/gem_fresh/gem_version.rb
Instance Attribute Summary collapse
-
#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
-
#initialize(version_string) ⇒ GemVersion
constructor
version_string is usually formatted like 7.6.2, but could be 7.6.2.11, 7.6, or even 7.6.2.beta.
Constructor Details
#initialize(version_string) ⇒ GemVersion
version_string is usually formatted like 7.6.2, but could be 7.6.2.11, 7.6, or even 7.6.2.beta. We just care about the first three numbers
8 9 10 11 |
# File 'lib/gem_fresh/gem_version.rb', line 8 def initialize(version_string) @major, @minor, @patch = version_string.split('.').map(&:to_i) @patch ||= 0 end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
3 4 5 |
# File 'lib/gem_fresh/gem_version.rb', line 3 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
3 4 5 |
# File 'lib/gem_fresh/gem_version.rb', line 3 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
3 4 5 |
# File 'lib/gem_fresh/gem_version.rb', line 3 def patch @patch end |