Class: Browsernizer::BrowserVersion

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/browsernizer/browser_version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_aObject

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_sObject


23
24
25
# File 'lib/browsernizer/browser_version.rb', line 23

def to_s
  @version
end