Class: Browsernizer::BrowserVersion
- Inherits:
-
Object
- Object
- Browsernizer::BrowserVersion
- Includes:
- Comparable
- Defined in:
- lib/browsernizer/browser_version.rb
Instance Attribute Summary collapse
-
#to_a ⇒ Object
Returns the value of attribute to_a.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(version) ⇒ BrowserVersion
constructor
A new instance of BrowserVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ BrowserVersion
Returns a new instance of BrowserVersion.
7 8 9 |
# File 'lib/browsernizer/browser_version.rb', line 7 def initialize(version) @version = version end |
Instance Attribute Details
#to_a ⇒ Object
Returns the value of attribute to_a.
5 6 7 |
# File 'lib/browsernizer/browser_version.rb', line 5 def to_a @to_a end |
Instance Method Details
#<=>(other) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/browsernizer/browser_version.rb', line 15 def <=>(other) ([0]*6).zip(to_a, [*other]).each do |dump, a, b| r = (a||0) <=> (b||0) return r unless r.zero? end 0 end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/browsernizer/browser_version.rb', line 23 def to_s @version end |