deeplink 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -0
- data/Rakefile +3 -3
- data/bin/console +1 -1
- data/deeplink.gemspec +2 -0
- data/lib/deeplink/link.rb +15 -9
- data/lib/deeplink/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ac83f203bee062497cc2ebca878eae22ebe1b7e
|
4
|
+
data.tar.gz: 6789df0472b6e9772815f1df0e0226b526cac83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 267849b340e535d0d932881e052e08b55832bd397f9c8515be65bd0b32dba82db9d54b24160747f68dba7ead9b1202b06c53f6f31ec2cc1f94a89cfcdebccbd9
|
7
|
+
data.tar.gz: 8177fafcda5010f18c6dbefd9f24808f169a2b9229b3aab7f128654aeca4a7c03941ed80db1cf12026ae4b016d9454a15ae8fc022faae95ab136cf69155dcc10
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
# Configuration parameters: AllowURI, URISchemes.
|
4
|
+
Metrics/LineLength:
|
5
|
+
Max: 100
|
6
|
+
|
7
|
+
# Offense count: 6
|
8
|
+
# Configuration parameters: Exclude.
|
9
|
+
Style/Documentation:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Assignment Branch Condition size
|
13
|
+
Metrics/AbcSize:
|
14
|
+
Max: 25
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/deeplink.gemspec
CHANGED
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.4.0', '>= 3.4.0'
|
26
26
|
spec.add_development_dependency 'pry', '~> 0.10.3'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.35'
|
28
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.3'
|
27
29
|
end
|
data/lib/deeplink/link.rb
CHANGED
@@ -9,6 +9,8 @@ module Deeplink
|
|
9
9
|
attr_reader :query
|
10
10
|
|
11
11
|
def initialize(uri)
|
12
|
+
return unless uri
|
13
|
+
|
12
14
|
uri = parse(uri)
|
13
15
|
|
14
16
|
self.scheme = uri.scheme
|
@@ -59,35 +61,39 @@ module Deeplink
|
|
59
61
|
#
|
60
62
|
# deeplink = Deeplink.parse("link://directions")
|
61
63
|
#
|
62
|
-
# deeplink.
|
64
|
+
# deeplink.query? # => false
|
63
65
|
#
|
64
66
|
# deeplink.add_query(foo: "bar") # => { :foo => "bar" }
|
65
67
|
#
|
66
|
-
# deeplink.
|
67
|
-
def
|
68
|
+
# deeplink.query? # => true
|
69
|
+
def query?
|
68
70
|
return false unless query
|
69
71
|
|
70
72
|
!query.empty?
|
71
73
|
end
|
72
74
|
|
75
|
+
alias_method :has_query?, :query?
|
76
|
+
|
73
77
|
# Returns the link as a String
|
74
78
|
def to_s
|
75
|
-
|
79
|
+
return '' unless scheme && path
|
80
|
+
|
81
|
+
uri = "#{scheme}:/#{path}"
|
76
82
|
|
77
|
-
if
|
83
|
+
if query?
|
78
84
|
query_string = query.map { |key, value| "#{key}=#{value}" }.join('&')
|
79
|
-
|
85
|
+
uri << "?#{query_string}"
|
80
86
|
end
|
81
87
|
|
82
|
-
|
88
|
+
uri
|
83
89
|
end
|
84
90
|
|
85
91
|
private
|
86
92
|
|
87
|
-
def parse(
|
93
|
+
def parse(original_uri)
|
88
94
|
# Because URI is dumb and thinks that every uri needs to have a host. Adding an extra slash
|
89
95
|
# we are basically tricking URI to think that host is nil (and avoid errors).
|
90
|
-
uri =
|
96
|
+
uri = original_uri.sub(%r{://}, ':///')
|
91
97
|
|
92
98
|
URI.parse(uri)
|
93
99
|
end
|
data/lib/deeplink/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deeplink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,34 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.10.3
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubocop
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.35'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.35'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rubocop-rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.3'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.3'
|
75
103
|
description: It mitigates the lack of support for mobile deep links on the URI module.
|
76
104
|
email:
|
77
105
|
- oterosantos@gmail.com
|
@@ -81,6 +109,7 @@ extra_rdoc_files: []
|
|
81
109
|
files:
|
82
110
|
- ".gitignore"
|
83
111
|
- ".rspec"
|
112
|
+
- ".rubocop.yml"
|
84
113
|
- ".ruby-version"
|
85
114
|
- ".travis.yml"
|
86
115
|
- Gemfile
|