platform_agent 1.0.0 → 1.0.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: 37665e6536aba2833b93dc0f111046ecd115a57c49e914301e2cf81921e7ae18
4
- data.tar.gz: a3601b3632b89ea98e8b3e5a1f8ea10b325de7c566811aa4b93a6ae5e59dbf2f
3
+ metadata.gz: 3d74b253a83cbc24d9bf3f56d00f137480b2f348573ad2aefee43168a2d070d9
4
+ data.tar.gz: 51d3ebb73e993af09dbe54011b2d839d3d4c81a903a2043babb0ebb1f2c9a705
5
5
  SHA512:
6
- metadata.gz: 62f9130310cc151af360e5720f53eb5319c156742e6b61c4ee1dc12c80e05c9e4e33c254cb07f48f72ffd69f8dbc763ee4798d98cb726f5c8b35c84300b4867d
7
- data.tar.gz: 979a7288c0d77cdc4af9b121b32a188b3b0cb737bc498f6c4f20b1d5fb7fabfd137e34687a2077ed3d85318d0ee32ae0e26478b13d441b6279bd6eac9c145d03
6
+ metadata.gz: f787a7d083e66116c9fd29f484081701e663d12c9368768483d58fc39942a8535a62dd094d81da1cc8dd3dde09e0a5e0957cac3eceedca6eefea9d0fd0a7743d
7
+ data.tar.gz: 5ba2b2327ebf805ea7c1a62f45b0a994fe340367298af59783c269c68ccb50e99e7c40343fc6c7bc8770df32d30b23bfe68841138435574597c63e15c20ed86f
data/README.md CHANGED
@@ -20,7 +20,7 @@ class ApplicationPlatform < PlatformAgent
20
20
 
21
21
  def windows_app?
22
22
  match?(/Electron/) && match?(/basecamp3/) && match?(/Windows/)
23
- end
23
+ end
24
24
  end
25
25
 
26
26
  module SetPlatform
@@ -47,8 +47,8 @@ end
47
47
 
48
48
  ## Maintenance Expectations
49
49
 
50
- This library is an extraction from Basecamp that's been sufficient in almost unaltered form for years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics.
50
+ This library is an extraction from Basecamp that's been sufficient in almost unaltered form for years. While contributions are always welcome, do not expect a lot of feature evolution beyond the basics.
51
51
 
52
52
  ## License
53
53
 
54
- Platform Agent is released under the [MIT License](https://opensource.org/licenses/MIT).
54
+ Platform Agent is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -5,7 +5,7 @@ class PlatformAgent
5
5
  self.user_agent_string = user_agent_string
6
6
  end
7
7
 
8
- delegate :browser, :version, :product, to: :user_agent
8
+ delegate :browser, :version, :product, :os, to: :user_agent
9
9
 
10
10
  def desktop?
11
11
  !mobile?
@@ -89,7 +89,7 @@ class PlatformAgent
89
89
 
90
90
  def app_version
91
91
  # App user-agent string is parsed into two separate UserAgent instances, it's the last one that contains the right version
92
- user_agent.last.version if native?
92
+ user_agent.last.version if native_app?
93
93
  end
94
94
 
95
95
  def to_s
@@ -110,7 +110,7 @@ class PlatformAgent
110
110
  attr_accessor :user_agent_string
111
111
 
112
112
  def match?(pattern)
113
- true if user_agent_string.to_s.match(pattern)
113
+ user_agent_string.to_s.match?(pattern)
114
114
  end
115
115
 
116
116
  def user_agent
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'platform_agent'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.authors = 'David Heinemeier Hansson'
5
5
  s.email = 'david@basecamp.com'
6
6
  s.summary = 'Parse user agent to deduce the platform.'
@@ -5,7 +5,7 @@ require 'platform_agent'
5
5
 
6
6
  class BasecampAgent < PlatformAgent
7
7
  def ios_app?
8
- match?(/BC3 iOS/)
8
+ match? /BC3 iOS/
9
9
  end
10
10
 
11
11
  def android_app?
@@ -18,7 +18,7 @@ class BasecampAgent < PlatformAgent
18
18
 
19
19
  def windows_app?
20
20
  match?(/Electron/) && match?(/basecamp3/) && match?(/Windows/)
21
- end
21
+ end
22
22
  end
23
23
 
24
24
  class PlatformAgentTest < ActiveSupport::TestCase
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: platform_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2019-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -99,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.7.3
102
+ rubygems_version: 3.0.3
104
103
  signing_key:
105
104
  specification_version: 4
106
105
  summary: Parse user agent to deduce the platform.