mobile-detect 0.1.1 → 0.1.2
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/lib/mobile-detect.rb +1 -0
- data/lib/mobile_detect/core.rb +7 -3
- data/lib/mobile_detect/version.rb +1 -1
- data/spec/mobile_detect_spec.rb +0 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f3aec6fad7f590097ad8c8606ddfc9dc7ca5940
|
4
|
+
data.tar.gz: eecd084c90844d3296441be0887b2413a8d5bb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e81b4439b4d99033aca36b4fc4454a877c7ccb0b9ece651e39ba5f6020163dfc5cf14f02d193efc6898c6d771cf8f8eba47f98aa0ffe132edbf8c7b0ef1dc35e
|
7
|
+
data.tar.gz: 115fb444a42ed28ea7eccd8c150a730e9bba5eda2f5cf8156eab1de6f70cfcc98cd097e42e30159b355b8c1655e64bc749ddf6f86984df7462fd22780266e8ed
|
@@ -0,0 +1 @@
|
|
1
|
+
require "mobile_detect"
|
data/lib/mobile_detect/core.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
class MobileDetect
|
4
|
-
attr_reader :http_headers
|
4
|
+
attr_reader :http_headers
|
5
5
|
attr_writer :user_agent
|
6
6
|
|
7
7
|
# Construct an instance of this class.
|
@@ -10,11 +10,15 @@ class MobileDetect
|
|
10
10
|
# from the http_headers hash instead.
|
11
11
|
|
12
12
|
def initialize(http_headers = {}, user_agent = nil)
|
13
|
-
|
13
|
+
@@data ||= load_json_data
|
14
14
|
self.http_headers = http_headers
|
15
15
|
self.user_agent = user_agent
|
16
16
|
end
|
17
17
|
|
18
|
+
def data
|
19
|
+
@@data
|
20
|
+
end
|
21
|
+
|
18
22
|
#UNIMPLEMENTED - incomplete data, property hash and utilities hash not provided
|
19
23
|
# version , prepareVersionNo
|
20
24
|
# mobileGrade
|
@@ -87,7 +91,7 @@ class MobileDetect
|
|
87
91
|
|
88
92
|
private
|
89
93
|
def load_json_data
|
90
|
-
File.open("data/Mobile_Detect.json", "r") do |file|
|
94
|
+
File.open(File.expand_path("../../../data/Mobile_Detect.json", __FILE__), "r") do |file|
|
91
95
|
JSON.load(file)
|
92
96
|
end
|
93
97
|
end
|
data/spec/mobile_detect_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile-detect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karthik T
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- data/Mobile_Detect.json
|
129
129
|
- data/get_latest_data.sh
|
130
130
|
- lib/Mobile_Detect.php
|
131
|
+
- lib/mobile-detect.rb
|
131
132
|
- lib/mobile_detect.rb
|
132
133
|
- lib/mobile_detect/core.rb
|
133
134
|
- lib/mobile_detect/version.rb
|