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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38fc122f4a51deada4c0f7abee448787cbaa05da
4
- data.tar.gz: b1cac31928b600851496b9f4014c7768616e7e8c
3
+ metadata.gz: 9ac83f203bee062497cc2ebca878eae22ebe1b7e
4
+ data.tar.gz: 6789df0472b6e9772815f1df0e0226b526cac83e
5
5
  SHA512:
6
- metadata.gz: 4dc8e84171e07fed9ea44ee479eac4c7a17db665335c9eb6de0487a852fbc8a1e2fbdf76ef195f0bfd33a4e49c74c0b63e44736db4812aed89aebf1d9356e13c
7
- data.tar.gz: 2f931309715664ccb18148701261a921f55d28ece1c4e8dce33f32a3f1e09e13465b636b3d3a09246015d0980c1eb9324678a533247dcb996139c07e129728ad
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
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -3,5 +3,5 @@
3
3
  require 'bundler/setup'
4
4
  require 'deeplink'
5
5
 
6
- require "pry"
6
+ require 'pry'
7
7
  Pry.start
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.has_query? # => false
64
+ # deeplink.query? # => false
63
65
  #
64
66
  # deeplink.add_query(foo: "bar") # => { :foo => "bar" }
65
67
  #
66
- # deeplink.has_query? # => true
67
- def has_query?
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
- string = "#{scheme}:/#{path}"
79
+ return '' unless scheme && path
80
+
81
+ uri = "#{scheme}:/#{path}"
76
82
 
77
- if has_query?
83
+ if query?
78
84
  query_string = query.map { |key, value| "#{key}=#{value}" }.join('&')
79
- string << "?#{query_string}"
85
+ uri << "?#{query_string}"
80
86
  end
81
87
 
82
- string
88
+ uri
83
89
  end
84
90
 
85
91
  private
86
92
 
87
- def parse(string)
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 = string.sub(%r{://}, ':///')
96
+ uri = original_uri.sub(%r{://}, ':///')
91
97
 
92
98
  URI.parse(uri)
93
99
  end
@@ -1,3 +1,3 @@
1
1
  module Deeplink
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
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.2
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-16 00:00:00.000000000 Z
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