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 +4 -4
- data/app/helpers/canonical_rails/tag_helper.rb +5 -1
- data/lib/canonical-rails.rb +9 -6
- data/lib/canonical-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eec59e3324fff400a64b6171ab133c8e28c5afe
|
4
|
+
data.tar.gz: b94aa1049224b4ce24b8befd90d003403a811ef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 "#{
|
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)
|
data/lib/canonical-rails.rb
CHANGED
@@ -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
|
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.
|
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:
|
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.
|
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
|