sape 0.1.5 → 0.1.6

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: 6bb0853e31de1b10077c70056900dd4ce842964b
4
- data.tar.gz: 7b3ad0343f91a2597dee1364b48f363a37742b62
3
+ metadata.gz: 32375f833f6695fe42316ad9bc8588222d986294
4
+ data.tar.gz: e9d69ad7470915fa431ebbea8d95d7b0aff464ed
5
5
  SHA512:
6
- metadata.gz: 0f2933e1e758f069b46a4a6aefdb1a95c92f297b8fe117ac70702b9b4354d6f7d1580f21b9f6ab8cfa9c51fee658e40e8ed25591fade75573a95cdd1e24c30d1
7
- data.tar.gz: 902a0313a2e93fee8373a5455da86d2a5a1e69fb245ce3d57ed0acdbd8c63f4f01752c120afe1887164c2d3120aae23bf1ed385a4384328de37c03ca5aa90808
6
+ metadata.gz: 2e5eed516e19f9938677740bd824ceee03102d89657aa800010de39cff0f3642cec623c3a5d5642ab2b5a6d74bd8a6c9be29fb82aa3a3ab43578178515877b1e
7
+ data.tar.gz: 3441f604c712fe027455d1b2e211286cb61c8041e0da30342ab4e335811aa8c5448d175e8ab44faaaa33f22eb058404323c50c53a832ecc33781f986997e506e
data/README.md CHANGED
@@ -35,13 +35,13 @@ charset: UTF-8
35
35
  #### Inserting links
36
36
  Simply put helper call in desired place. Like this:
37
37
  ```ruby
38
- <% # SIMPLE LINKS %>
38
+ <% # SIMPLE LINKS, custom parameter 'site_host', default: request.host %>
39
39
  <%= sape_links -%>
40
40
 
41
- <% # BLOCK LINKS %>
41
+ <% # BLOCK LINKS, custom parameter 'site_host', default: request.host %>
42
42
  <%= sape_links_block -%>
43
43
 
44
- <% # CONTEXT LINKS %>
44
+ <% # CONTEXT LINKS, custom parameter 'site_host', default: request.host %>
45
45
  <%= sape_context_links text -%>
46
46
  ```
47
47
 
@@ -1,7 +1,7 @@
1
1
  module SapeHelper
2
- def sape_links_block
2
+ def sape_links_block(site_host = request.host)
3
3
  request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
4
- options = { links: SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: request.host) }
4
+ options = { links: SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: site_host) }
5
5
  if SapeConfig.bot_ips.include?(request.remote_addr)
6
6
  options.merge!(check_code: SapeConfig.check_code)
7
7
  end
@@ -11,9 +11,9 @@ module SapeHelper
11
11
  "<!-- ERROR: #{e.message} -->".html_safe
12
12
  end
13
13
 
14
- def sape_links
14
+ def sape_links(site_host = request.host)
15
15
  request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
16
- links = SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: request.host).
16
+ links = SapeLink.where(page: request.original_fullpath, link_type: "simple", site_host: site_host).
17
17
  pluck(:raw_link).
18
18
  join(SapeConfig.delimiter)
19
19
 
@@ -22,9 +22,9 @@ module SapeHelper
22
22
  "<!-- ERROR: #{e.message} -->".html_safe
23
23
  end
24
24
 
25
- def sape_context_links(text)
25
+ def sape_context_links(text, site_host = request.host)
26
26
  request.original_fullpath.chomp!("/") if request.original_fullpath.last == "/" && request.original_fullpath != '/'
27
- SapeLink.where(page: request.original_fullpath, link_type: "context", site_host: request.host).each do |link|
27
+ SapeLink.where(page: request.original_fullpath, link_type: "context", site_host: site_host).each do |link|
28
28
  text.sub!(link.anchor, link.raw_link)
29
29
  end
30
30
 
data/lib/sape/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sape
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Rodionov