canonical-rails 0.0.7 → 0.0.8

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: 9c68bd97df62242170b4e6bf2857318c773d9b37
4
- data.tar.gz: 6918feb08f1ba0bda70c1a026f92a6d70c3f0213
3
+ metadata.gz: 5eec59e3324fff400a64b6171ab133c8e28c5afe
4
+ data.tar.gz: b94aa1049224b4ce24b8befd90d003403a811ef3
5
5
  SHA512:
6
- metadata.gz: 17f9e7fa969a16ee2cc813c2f71509e4f779ad58cc3ac6db50da564f5f0675b31097d828a592e2ca5e6a0018e5caa288c031d9fd350f14a6a1570709dcd118db
7
- data.tar.gz: 67b60b299dd2e433249034b9291656bd2bded2167883d158268963565994f7c435fd26cf21f1a4f1ef9cfcaaaf6cfd294e27b6bb83a9aed27a7c7de51992a1a1
6
+ metadata.gz: 7e7798e0bf8918c44b5dd8a8b34655f73808ae8a22f211b551fe78a2f5565a6f139e16bcd4a315835e49aa667ade1dc5bfc2076bb0821357365978ad251686a0
7
+ data.tar.gz: 70f4ced48fc46b56e18d4d9226b68e129962a77df8eb138900ad85acd631ccf9eb88863848e6733b507aacddcff85535dcd98f9724cdeb41555b62d94fdfe8a4
@@ -13,12 +13,16 @@ module CanonicalRails
13
13
  request.path.sub(/\.html$/, '')
14
14
  end
15
15
 
16
+ def canonical_protocol
17
+ CanonicalRails.protocol || request.protocol
18
+ end
19
+
16
20
  def canonical_host
17
21
  CanonicalRails.host || request.host
18
22
  end
19
23
 
20
24
  def canonical_href(host=canonical_host)
21
- raw "#{request.protocol}#{host}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}"
25
+ raw "#{canonical_protocol}#{host}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}"
22
26
  end
23
27
 
24
28
  def canonical_tag(host=canonical_host)
@@ -6,29 +6,32 @@ module CanonicalRails
6
6
  # a fresh initializer with all configuration values.
7
7
  #
8
8
  # the config\setup concept politely observed at and borrowed from Devise: https://github.com/plataformatec/devise/blob/master/lib/devise.rb
9
-
9
+
10
10
  def self.setup
11
11
  yield self
12
12
  end
13
13
 
14
14
  mattr_accessor :host
15
15
  @@host = nil
16
-
16
+
17
+ mattr_accessor :protocol
18
+ @@protocol = nil
19
+
17
20
  mattr_accessor :collection_actions
18
21
  @@collection_actions = [:index]
19
-
22
+
20
23
  mattr_accessor :member_actions
21
24
  @@member_actions = [:show]
22
-
25
+
23
26
  mattr_accessor :whitelisted_parameters
24
27
  @@whitelisted_parameters = []
25
28
 
26
29
  def self.sym_collection_actions
27
30
  @@sym_collection_actions ||= self.collection_actions.map(&:to_sym)
28
31
  end
29
-
32
+
30
33
  def self.sym_whitelisted_parameters
31
34
  @@sym_whitelisted_actions ||= self.whitelisted_parameters.map(&:to_sym)
32
35
  end
33
-
36
+
34
37
  end
@@ -1,3 +1,3 @@
1
1
  module CanonicalRails
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canonical-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.2.1
100
+ rubygems_version: 2.4.3
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: Simple and configurable Rails canonical ref tag helper