Class: Browsernizer::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/browsernizer/browser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version) ⇒ Browser

Returns a new instance of Browser.


7
8
9
10
11
12
13
14
# File 'lib/browsernizer/browser.rb', line 7

def initialize(name, version)
  @name = name.to_s
  if version === false
    @version = false
  else
    @version = BrowserVersion.new version.to_s
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


5
6
7
# File 'lib/browsernizer/browser.rb', line 5

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version


5
6
7
# File 'lib/browsernizer/browser.rb', line 5

def version
  @version
end

Instance Method Details

#meets?(requirement) ⇒ Boolean

Returns:

  • (Boolean)

16
17
18
19
20
21
22
23
24
25
26
# File 'lib/browsernizer/browser.rb', line 16

def meets?(requirement)
  if name.downcase == requirement.name.downcase
    if requirement.version === false
      false
    else
      version >= requirement.version
    end
  else
    nil
  end
end