Class: CMSScanner::Version
- Inherits:
-
Object
- Object
- CMSScanner::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.
8 9 10 11 12 13 |
# File 'app/models/version.rb', line 8 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.
6 7 8 |
# File 'app/models/version.rb', line 6 def number @number end |
Instance Method Details
#<(other) ⇒ Object
23 24 25 |
# File 'app/models/version.rb', line 23 def <(other) (self <=> other) == -1 end |
#<=>(other) ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/models/version.rb', line 33 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
17 18 19 |
# File 'app/models/version.rb', line 17 def ==(other) (self <=> other) == 0 end |
#>(other) ⇒ Object
28 29 30 |
# File 'app/models/version.rb', line 28 def >(other) (self <=> other) == 1 end |
#to_s ⇒ Object
41 42 43 |
# File 'app/models/version.rb', line 41 def to_s number end |