Class: CMSScanner::Model::Version
- Inherits:
-
Object
- Object
- CMSScanner::Model::Version
- Includes:
- Finders::Finding
- Defined in:
- app/models/version.rb
Overview
Version
Constant Summary
Constants included from Finders::Finding
Finders::Finding::FINDING_OPTS
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #<(other) ⇒ Object
- #<=>(other) ⇒ Object
-
#==(other) ⇒ Object
rubocop:disable Style/NumericPredicate.
- #>(other) ⇒ Object
-
#initialize(number, opts = {}) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Methods included from Finders::Finding
#confidence, #confidence=, #confirmed_by, #eql?, included, #interesting_entries, #parse_finding_options
Constructor Details
#initialize(number, opts = {}) ⇒ Version
Returns a new instance of Version.
11 12 13 14 15 16 |
# File 'app/models/version.rb', line 11 def initialize(number, opts = {}) @number = number.to_s @number = "0#{number}" if @number[0, 1] == '.' (opts) end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'app/models/version.rb', line 9 def number @number end |
Instance Method Details
#<(other) ⇒ Object
26 27 28 |
# File 'app/models/version.rb', line 26 def <(other) (self <=> other) == -1 end |
#<=>(other) ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/models/version.rb', line 36 def <=>(other) other = self.class.new(other) unless other.is_a?(self.class) # handle potential '.1' version Gem::Version.new(number) <=> Gem::Version.new(other.number) rescue ArgumentError false end |
#==(other) ⇒ Object
rubocop:disable Style/NumericPredicate
20 21 22 |
# File 'app/models/version.rb', line 20 def ==(other) (self <=> other) == 0 end |
#>(other) ⇒ Object
31 32 33 |
# File 'app/models/version.rb', line 31 def >(other) (self <=> other) == 1 end |
#to_s ⇒ Object
44 45 46 |
# File 'app/models/version.rb', line 44 def to_s number end |