fast_woothee 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a807711a16c87cc99d3bf1e739a80e7bef5a07296d8e8189075456d8224091fb
4
- data.tar.gz: b7136e863e4ab5e539d7ed13d34d67d15433e9914f1a426f7471ae2d04b42038
3
+ metadata.gz: 1076f8ee01ec70e75ace3bc424dab28a7fb5d569bf013a6eb7abfc0a2a4b6091
4
+ data.tar.gz: f429a9f3a14a46b96dcacc8965596c7bae44b737885fd64d3304f569ac7969ee
5
5
  SHA512:
6
- metadata.gz: 9edc06f642a405ed067ae42e7a8d0283bf219cf568839c052718ac211cef1f5d17c0dbb09cde72196e121a85f57104e96b5626efa9fdf06b56188c81b0558ac8
7
- data.tar.gz: 97e43dd766e88d4f22857e6f1788ab509eb618683a429b787f06014c5b0e598fe242a1ce41d435aeab372ce2b109fe3f404fcba48f6239b40f1b3e637e1b811f
6
+ metadata.gz: d6b0b73032ac8da0dc9f39517a43679b934095859640c3976f129686703f50ddfe9597b9d8994c6856e8979920e99e8417a7e1d70418e4eba231619b2b497618
7
+ data.tar.gz: 86ddbfd03367e1d8a08d521e0d4a88fce8f41356b7808991fd7f25c5f621b11b0373857f31b5222d5662aa943a1e0101da6301f1c769ff22b26bc710256a9d3b
data/Cargo.lock CHANGED
@@ -8,10 +8,10 @@ dependencies = [
8
8
 
9
9
  [[package]]
10
10
  name = "fast_woothee"
11
- version = "1.4.0"
11
+ version = "1.4.4"
12
12
  dependencies = [
13
13
  "ruru 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
14
- "woothee 0.8.0 (git+https://github.com/woothee/woothee-rust)",
14
+ "woothee 0.9.0 (git+https://github.com/woothee/woothee-rust)",
15
15
  ]
16
16
 
17
17
  [[package]]
@@ -91,8 +91,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
91
91
 
92
92
  [[package]]
93
93
  name = "woothee"
94
- version = "0.8.0"
95
- source = "git+https://github.com/woothee/woothee-rust#4a082422424cfe07fcbbcc7f520ef26ce4c2bb7c"
94
+ version = "0.9.0"
95
+ source = "git+https://github.com/woothee/woothee-rust#f98a1c36365f733d7815eb28a3f5e175b30601bb"
96
96
  dependencies = [
97
97
  "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
98
98
  "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -111,4 +111,4 @@ dependencies = [
111
111
  "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
112
112
  "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
113
113
  "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
114
- "checksum woothee 0.8.0 (git+https://github.com/woothee/woothee-rust)" = "<none>"
114
+ "checksum woothee 0.9.0 (git+https://github.com/woothee/woothee-rust)" = "<none>"
data/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "fast_woothee"
3
- version = "1.4.3"
3
+ version = "1.4.4"
4
4
  authors = ["Ian Ker-Seymer <i.kerseymer@gmail.com>"]
5
5
  repository = "https://github.com/ianks/fast_woothee"
6
6
  publish = false
data/README.md CHANGED
@@ -31,6 +31,16 @@ FastWoothee.parse 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) Appl
31
31
  # {:name=>"Webview", :category=>"smartphone", :os=>"iPad", :os_version=>"3.2.1", :browser_type=>"browser", :version=>"UNKNOWN", :vendor=>"OS vendor"}
32
32
  ```
33
33
 
34
+ ```ruby
35
+ # Determine if it is a crawler
36
+ FastWoothee.crawler?("Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html") # => true
37
+ ```
38
+
39
+ ```ruby
40
+ # Is the user on iOS?
41
+ FastWoothee.ios?("Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4") # => true
42
+ ```
43
+
34
44
  ## Benchmarks
35
45
 
36
46
  ```
data/fast_woothee.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fast_woothee'
8
- spec.version = '1.4.3'
8
+ spec.version = '1.4.4'
9
9
  spec.authors = ['Ian Ker-Seymer']
10
10
  spec.email = ['i.kerseymer@gmail.com']
11
11
 
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ['lib']
23
23
  spec.extensions = ['Rakefile']
24
24
 
25
- spec.add_runtime_dependency 'thermite', '~> 0'
26
25
 
27
26
  spec.add_development_dependency 'bundler', '~> 2.0'
28
27
  spec.add_development_dependency 'ffi', '~> 1.9'
@@ -31,4 +30,5 @@ Gem::Specification.new do |spec|
31
30
  spec.add_development_dependency 'rake', '~> 10.0'
32
31
  spec.add_development_dependency 'rake-compiler'
33
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
+ spec.add_development_dependency 'thermite', '~> 0'
34
34
  end
data/src/lib.rs CHANGED
@@ -34,16 +34,37 @@ methods!(
34
34
  methods!(
35
35
  FastWoothee,
36
36
  _itself,
37
- fn crawler(ua_string: RString) -> Boolean {
37
+ fn is_crawler(ua_string: RString) -> Boolean {
38
38
  Boolean::new(woothee::is_crawler(ua_string.unwrap_or(RString::new("")).to_str()))
39
39
  }
40
40
  );
41
41
 
42
+ methods!(
43
+ FastWoothee,
44
+ _itself,
45
+ fn is_ios(ua_string: RString) -> Boolean {
46
+ let parser = Parser::new();
47
+
48
+ match parser.parse(ua_string.unwrap_or(RString::new("")).to_str()) {
49
+ None => Boolean::new(false),
50
+ Some(result) => {
51
+ match result.os {
52
+ "iPod" => Boolean::new(true),
53
+ "iPad" => Boolean::new(true),
54
+ "iPhone" => Boolean::new(true),
55
+ _ => Boolean::new(false)
56
+ }
57
+ }
58
+ }
59
+ }
60
+ );
61
+
42
62
  #[no_mangle]
43
63
  pub extern fn initialize_fast_woothee() {
44
64
  Class::new("FastWoothee", None).define(|itself| {
45
- itself.const_set("VERSION", &RString::new("1.4.3").freeze());
65
+ itself.const_set("VERSION", &RString::new("1.4.4").freeze());
46
66
  itself.def_self("parse", parse);
47
- itself.def_self("crawler?", crawler);
67
+ itself.def_self("crawler?", is_crawler);
68
+ itself.def_self("ios?", is_ios);
48
69
  });
49
70
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_woothee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
@@ -10,20 +10,6 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2019-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: thermite
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +108,20 @@ dependencies:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
110
  version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: thermite
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
125
  description: Ruby bindings to woothee-rust
126
126
  email:
127
127
  - i.kerseymer@gmail.com