agents 0.1.0 → 0.1.1

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: 63094ffe429b769ce63767ad2f3613a31887ae403656dce29cd36a8d50ba892e
4
- data.tar.gz: b6e687fe9c858c3d739102df4bcbab6d4094e9e2791e9397037be216fa74031e
3
+ metadata.gz: 4cb67fbba1de6d9d25fe57c932494d7da9564237ec56cc58555fe2923a7d93c4
4
+ data.tar.gz: 40fa474816c93e8811cdd16f73dc96ae96c9de5870ebb64a80a0dcccadb74d8b
5
5
  SHA512:
6
- metadata.gz: bf3ccea1fbae75943aa8efcd29278adb20f45a43fb6707f290aeb370de18734accc2de32e47bb02c73fa3798cfa633a907ead4f97f5bc8caee460593916d0b63
7
- data.tar.gz: f344f6f9f148eaf98c1115e99ba997908fab2246208eea85f369a62573cd0263e5428a60772c97c74cb43b350691c90bce96c057cf060cbaaaa32fd8123bc5de
6
+ metadata.gz: 0aadbc5acdf5913c03c219dc83184d08d7c3678b030dbfe87a71ba619b9e491b824e0ad6c8ebc7b1d272cfd0f7d6d87999f6d9ff8554d818b7ce96772e3d203c
7
+ data.tar.gz: 1a1f368621c3959b90cbd0fb28d5035184b29557e578250cae32aa7d76cec03536ef6d6aca9a20b16b708b885944c93822ce8eb7b15826695d7ebdae91d6c19e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- agents (0.1.0)
4
+ agents (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/agents.rb CHANGED
@@ -3,9 +3,23 @@ require "agents/constants"
3
3
 
4
4
  module Agents
5
5
 
6
- def self.random_user_agent(*args)
7
- args = (args.nil? || args.empty?) ? [:desktop] : args
8
- ::Agents::Constants::USER_AGENTS.dig(*args&.collect(&:to_sym))&.sample
6
+ class << self
7
+ def random_user_agent(*args)
8
+ args = (args.nil? || args.empty?) ? [:desktop] : args
9
+ ::Agents::Constants::USER_AGENTS.dig(*args&.collect(&:to_sym))&.sample
10
+ end
11
+
12
+ def runs_ios?(user_agent)
13
+ is_iphone?(user_agent) || is_ipad?(user_agent)
14
+ end
15
+
16
+ def is_iphone?(user_agent)
17
+ !(user_agent =~ /iphone|cpu\siphone/i).nil?
18
+ end
19
+
20
+ def is_ipad?(user_agent)
21
+ !(user_agent =~ /ipad/i).nil?
22
+ end
9
23
  end
10
24
 
11
25
  end
@@ -1,3 +1,3 @@
1
1
  module Agents
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler