Class: VagrantBoxVersion::VersionString
- Inherits:
-
Object
- Object
- VagrantBoxVersion::VersionString
- Includes:
- Comparable
- Defined in:
- lib/vagrant_box_version/version-checking.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(string) ⇒ VersionString
constructor
A new instance of VersionString.
- #to_s ⇒ Object
Constructor Details
#initialize(string) ⇒ VersionString
Returns a new instance of VersionString.
13 14 15 16 |
# File 'lib/vagrant_box_version/version-checking.rb', line 13 def initialize(string) @build = string.strip[/[^-]*/].to_i @hash = if string.include? "-" then string.strip.split("-")[1] else "" end end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build.
10 11 12 |
# File 'lib/vagrant_box_version/version-checking.rb', line 10 def build @build end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
10 11 12 |
# File 'lib/vagrant_box_version/version-checking.rb', line 10 def hash @hash end |
Instance Method Details
#<=>(other) ⇒ Object
22 23 24 |
# File 'lib/vagrant_box_version/version-checking.rb', line 22 def <=>(other) build <=> other.build end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/vagrant_box_version/version-checking.rb', line 18 def to_s "#@build-#@hash" end |