Class: RuboCop::SketchUp::SketchUpVersion
- Inherits:
-
Object
- Object
- RuboCop::SketchUp::SketchUpVersion
- Includes:
- Comparable
- Defined in:
- lib/rubocop/sketchup/sketchup_version.rb
Defined Under Namespace
Classes: InvalidVersion
Instance Attribute Summary collapse
-
#maintenance ⇒ Object
readonly
Returns the value of attribute maintenance.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(version) ⇒ SketchUpVersion
constructor
A new instance of SketchUpVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ SketchUpVersion
Returns a new instance of SketchUpVersion.
13 14 15 |
# File 'lib/rubocop/sketchup/sketchup_version.rb', line 13 def initialize(version) @version, @maintenance = parse_version(version) end |
Instance Attribute Details
#maintenance ⇒ Object (readonly)
Returns the value of attribute maintenance.
9 10 11 |
# File 'lib/rubocop/sketchup/sketchup_version.rb', line 9 def maintenance @maintenance end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/rubocop/sketchup/sketchup_version.rb', line 9 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rubocop/sketchup/sketchup_version.rb', line 17 def <=>(other) if version == other.version maintenance <=> other.maintenance else version <=> other.version end end |
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/rubocop/sketchup/sketchup_version.rb', line 25 def to_s string_version = version < 2013 ? version.to_f : version.to_i if maintenance > 0 "SketchUp #{string_version} M#{maintenance}" else "SketchUp #{string_version}" end end |