brauser 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis-gemfile +2 -2
- data/.travis.yml +1 -3
- data/.yardopts +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +3 -3
- data/README.md +30 -2
- data/Rakefile +14 -2
- data/brauser.gemspec +1 -1
- data/doc/Brauser.html +3 -3
- data/doc/Brauser/Browser.html +2208 -1908
- data/doc/Brauser/Definitions.html +29 -25
- data/doc/Brauser/Definitions/Base.html +18 -16
- data/doc/Brauser/Definitions/Browser.html +215 -210
- data/doc/Brauser/Definitions/Language.html +40 -37
- data/doc/Brauser/Definitions/Platform.html +74 -70
- data/doc/Brauser/Hooks.html +4 -4
- data/doc/Brauser/Hooks/RubyOnRails.html +12 -10
- data/doc/Brauser/Parser.html +27 -24
- data/doc/Brauser/Value.html +44 -40
- data/doc/Brauser/Version.html +11 -7
- data/doc/_index.html +4 -4
- data/doc/class_list.html +5 -1
- data/doc/file.README.html +77 -50
- data/doc/file_list.html +5 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +77 -50
- data/doc/js/full_list.js +4 -1
- data/doc/method_list.html +31 -21
- data/doc/top-level-namespace.html +3 -3
- data/lib/brauser/browser.rb +15 -5
- data/lib/brauser/definitions/platform.rb +1 -1
- data/lib/brauser/hooks.rb +1 -1
- data/lib/brauser/version.rb +1 -1
- data/spec/brauser/browser_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -8
- metadata +5 -5
data/doc/js/full_list.js
CHANGED
@@ -123,7 +123,10 @@ function linkList() {
|
|
123
123
|
}
|
124
124
|
}
|
125
125
|
if (clicked) clicked.removeClass('clicked');
|
126
|
-
var win
|
126
|
+
var win;
|
127
|
+
try {
|
128
|
+
win = window.top.frames.main ? window.top.frames.main : window.parent;
|
129
|
+
} catch (e) { win = window.parent; }
|
127
130
|
if (this.tagName.toLowerCase() == "a") {
|
128
131
|
clicked = $(this).parents('li').addClass('clicked');
|
129
132
|
win.location = this.href;
|
data/doc/method_list.html
CHANGED
@@ -20,7 +20,11 @@
|
|
20
20
|
</head>
|
21
21
|
<body>
|
22
22
|
<script type="text/javascript" charset="utf-8">
|
23
|
-
|
23
|
+
var hasFrames = false;
|
24
|
+
try {
|
25
|
+
hasFrames = window.top.frames.main ? true : false;
|
26
|
+
} catch (e) { }
|
27
|
+
if (hasFrames) {
|
24
28
|
document.getElementById('base_target').target = 'main';
|
25
29
|
document.body.className = 'frames';
|
26
30
|
}
|
@@ -138,20 +142,20 @@
|
|
138
142
|
|
139
143
|
|
140
144
|
<li class="r2 ">
|
141
|
-
<span class='object_link'><a href="Brauser/
|
142
|
-
<small>Brauser::
|
145
|
+
<span class='object_link'><a href="Brauser/Definitions/Platform.html#initialize-instance_method" title="Brauser::Definitions::Platform#initialize (method)">#initialize</a></span>
|
146
|
+
<small>Brauser::Definitions::Platform</small>
|
143
147
|
</li>
|
144
148
|
|
145
149
|
|
146
150
|
<li class="r1 ">
|
147
|
-
<span class='object_link'><a href="Brauser/
|
148
|
-
<small>Brauser::
|
151
|
+
<span class='object_link'><a href="Brauser/Value.html#initialize-instance_method" title="Brauser::Value#initialize (method)">#initialize</a></span>
|
152
|
+
<small>Brauser::Value</small>
|
149
153
|
</li>
|
150
154
|
|
151
155
|
|
152
156
|
<li class="r2 ">
|
153
|
-
<span class='object_link'><a href="Brauser/Definitions/
|
154
|
-
<small>Brauser::Definitions::
|
157
|
+
<span class='object_link'><a href="Brauser/Definitions/Browser.html#initialize-instance_method" title="Brauser::Definitions::Browser#initialize (method)">#initialize</a></span>
|
158
|
+
<small>Brauser::Definitions::Browser</small>
|
155
159
|
</li>
|
156
160
|
|
157
161
|
|
@@ -192,14 +196,14 @@
|
|
192
196
|
|
193
197
|
|
194
198
|
<li class="r1 ">
|
195
|
-
<span class='object_link'><a href="Brauser/Definitions/
|
196
|
-
<small>Brauser::Definitions::
|
199
|
+
<span class='object_link'><a href="Brauser/Definitions/Platform.html#match-instance_method" title="Brauser::Definitions::Platform#match (method)">#match</a></span>
|
200
|
+
<small>Brauser::Definitions::Platform</small>
|
197
201
|
</li>
|
198
202
|
|
199
203
|
|
200
204
|
<li class="r2 ">
|
201
|
-
<span class='object_link'><a href="Brauser/Definitions/
|
202
|
-
<small>Brauser::Definitions::
|
205
|
+
<span class='object_link'><a href="Brauser/Definitions/Browser.html#match-instance_method" title="Brauser::Definitions::Browser#match (method)">#match</a></span>
|
206
|
+
<small>Brauser::Definitions::Browser</small>
|
203
207
|
</li>
|
204
208
|
|
205
209
|
|
@@ -210,20 +214,20 @@
|
|
210
214
|
|
211
215
|
|
212
216
|
<li class="r2 ">
|
213
|
-
<span class='object_link'><a href="Brauser/
|
214
|
-
<small>Brauser::
|
217
|
+
<span class='object_link'><a href="Brauser/Browser.html#method_missing-instance_method" title="Brauser::Browser#method_missing (method)">#method_missing</a></span>
|
218
|
+
<small>Brauser::Browser</small>
|
215
219
|
</li>
|
216
220
|
|
217
221
|
|
218
222
|
<li class="r1 ">
|
219
|
-
<span class='object_link'><a href="Brauser/
|
220
|
-
<small>Brauser::
|
223
|
+
<span class='object_link'><a href="Brauser/Value.html#method_missing-instance_method" title="Brauser::Value#method_missing (method)">#method_missing</a></span>
|
224
|
+
<small>Brauser::Value</small>
|
221
225
|
</li>
|
222
226
|
|
223
227
|
|
224
228
|
<li class="r2 ">
|
225
|
-
<span class='object_link'><a href="Brauser/Definitions/
|
226
|
-
<small>Brauser::Definitions::
|
229
|
+
<span class='object_link'><a href="Brauser/Definitions/Platform.html#name-instance_method" title="Brauser::Definitions::Platform#name (method)">#name</a></span>
|
230
|
+
<small>Brauser::Definitions::Platform</small>
|
227
231
|
</li>
|
228
232
|
|
229
233
|
|
@@ -234,8 +238,8 @@
|
|
234
238
|
|
235
239
|
|
236
240
|
<li class="r2 ">
|
237
|
-
<span class='object_link'><a href="Brauser/Definitions/
|
238
|
-
<small>Brauser::Definitions::
|
241
|
+
<span class='object_link'><a href="Brauser/Definitions/Language.html#name-instance_method" title="Brauser::Definitions::Language#name (method)">#name</a></span>
|
242
|
+
<small>Brauser::Definitions::Language</small>
|
239
243
|
</li>
|
240
244
|
|
241
245
|
|
@@ -276,18 +280,24 @@
|
|
276
280
|
|
277
281
|
|
278
282
|
<li class="r1 ">
|
283
|
+
<span class='object_link'><a href="Brauser/Browser.html#supported%3F-instance_method" title="Brauser::Browser#supported? (method)">#supported?</a></span>
|
284
|
+
<small>Brauser::Browser</small>
|
285
|
+
</li>
|
286
|
+
|
287
|
+
|
288
|
+
<li class="r2 ">
|
279
289
|
<span class='object_link'><a href="Brauser/Value.html#value-instance_method" title="Brauser::Value#value (method)">#value</a></span>
|
280
290
|
<small>Brauser::Value</small>
|
281
291
|
</li>
|
282
292
|
|
283
293
|
|
284
|
-
<li class="
|
294
|
+
<li class="r1 ">
|
285
295
|
<span class='object_link'><a href="Brauser/Browser.html#version-instance_method" title="Brauser::Browser#version (method)">#version</a></span>
|
286
296
|
<small>Brauser::Browser</small>
|
287
297
|
</li>
|
288
298
|
|
289
299
|
|
290
|
-
<li class="
|
300
|
+
<li class="r2 ">
|
291
301
|
<span class='object_link'><a href="Brauser/Definitions/Browser.html#version_matcher-instance_method" title="Brauser::Definitions::Browser#version_matcher (method)">#version_matcher</a></span>
|
292
302
|
<small>Brauser::Definitions::Browser</small>
|
293
303
|
</li>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -103,9 +103,9 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on Mon
|
106
|
+
Generated on Mon Mar 2 13:10:31 2015 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
-
0.8.7.
|
108
|
+
0.8.7.6 (ruby-2.2.0).
|
109
109
|
</div>
|
110
110
|
|
111
111
|
</body>
|
data/lib/brauser/browser.rb
CHANGED
@@ -73,13 +73,13 @@ module Brauser
|
|
73
73
|
|
74
74
|
# Checks if the browser matches a specific query.
|
75
75
|
#
|
76
|
-
# @param name [Symbol|Array] The list of names to check. Also, this meta-name is supported: `:tablet`.
|
77
|
-
# @param engine [Symbol|Array] Alias for `name`, **which has precedence over this.**
|
78
|
-
# @param version [String] The query to match the version.
|
76
|
+
# @param name [Symbol|Array|NilClass] The list of names to check. Also, this meta-name is supported: `:tablet`.
|
77
|
+
# @param engine [Symbol|Array|NilClass] Alias for `name`, **which has precedence over this.**
|
78
|
+
# @param version [String|NilClass] The query to match the version.
|
79
79
|
# It must be a query in the form is `OPERATOR VALUE && ..`, where `OPERATOR` is one of `["<", "<=", "=", "==", ">=", ">"]`.
|
80
80
|
# You can also pass the value "capable", which will return true for Webkit browsers, IE 10 or above, Firefox 28 and above and Opera 15 and above.
|
81
|
-
# @param platform [Symbol|Array] The list of platforms to check.
|
82
|
-
# @param languages [Symbol|Array] The list of languages to check.
|
81
|
+
# @param platform [Symbol|Array|NilClass] The list of platforms to check.
|
82
|
+
# @param languages [Symbol|Array|NilClass] The list of languages to check.
|
83
83
|
# @return [Boolean] `true` if browser match the query, `false` otherwise.
|
84
84
|
def is?(name: nil, engine: nil, version: nil, platform: nil, languages: nil)
|
85
85
|
name ||= engine
|
@@ -90,6 +90,16 @@ module Brauser
|
|
90
90
|
rv
|
91
91
|
end
|
92
92
|
|
93
|
+
# Check if the browser is supported.
|
94
|
+
#
|
95
|
+
# @param browsers [Hash|String] A map of name and minimum supported major version, or a path to YAML file containing the map.
|
96
|
+
# @return [Boolean] `true` if current browser is supported, `false` otherwise. If the name is not found in the map, `false` is returned.
|
97
|
+
def supported?(browsers = {})
|
98
|
+
browsers = YAML.load_file(browsers.to_s).symbolize_keys unless browsers.is_a?(Hash)
|
99
|
+
minimum_version = browsers.with_indifferent_access[name.value]
|
100
|
+
minimum_version ? is?(version: ">= #{minimum_version}") : false
|
101
|
+
end
|
102
|
+
|
93
103
|
# Check if the browser is a specific one
|
94
104
|
#
|
95
105
|
# @param method The browser engine to check.
|
@@ -18,7 +18,7 @@ module Brauser
|
|
18
18
|
#
|
19
19
|
# @param id [Symbol] The platform id.
|
20
20
|
# @param name [String] The platform name.
|
21
|
-
# @param matcher [Regexp|Proc] The pattern or the block to recognize the platform. **
|
21
|
+
# @param matcher [Regexp|Proc] The pattern or the block to recognize the platform. **Ignored if a block is given.**
|
22
22
|
def initialize(id, name, matcher = /.*/, **_, &block)
|
23
23
|
@id = id
|
24
24
|
@name = name
|
data/lib/brauser/hooks.rb
CHANGED
data/lib/brauser/version.rb
CHANGED
@@ -101,6 +101,20 @@ describe Brauser::Browser do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
describe "#supported?" do
|
105
|
+
it "should check whether the browser is supported" do
|
106
|
+
expect(subject.supported?({chrome: 21})).to be_truthy
|
107
|
+
expect(subject.supported?({chrome: 20})).to be_truthy
|
108
|
+
expect(subject.supported?({chrome: 22})).to be_falsey
|
109
|
+
expect(subject.supported?({})).to be_falsey
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should load from a file" do
|
113
|
+
expect(YAML).to receive(:load_file).with("/dev/null").and_return({chrome: 21})
|
114
|
+
expect(subject.supported?("/dev/null")).to be_truthy
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
104
118
|
describe "#method_missing" do
|
105
119
|
it "should attempt to run #is? with the method as name if it ends with a ?" do
|
106
120
|
expect(subject.chrome?).to be_truthy
|
data/spec/spec_helper.rb
CHANGED
@@ -3,12 +3,5 @@
|
|
3
3
|
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
4
4
|
#
|
5
5
|
|
6
|
-
require "rubygems"
|
7
6
|
require "bundler/setup"
|
8
|
-
require "brauser"
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.expect_with :rspec do |c|
|
12
|
-
c.syntax = :expect
|
13
|
-
end
|
14
|
-
end
|
7
|
+
require File.dirname(__FILE__) + "/../lib/brauser"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brauser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lazier
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: versionomy
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project: brauser
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.5
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A framework agnostic browser detection and querying helper.
|