preciousss 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/preciousss/controllers/helpers.rb +7 -3
- data/lib/preciousss/version.rb +1 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Preciousss
|
2
2
|
module Controllers
|
3
3
|
module Helpers
|
4
|
-
BOTS_REGEXP =
|
4
|
+
BOTS_REGEXP = /\b(Googlebot|facebookexternalhit|Baidu|Gigabot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)\b/i
|
5
5
|
|
6
6
|
def self.included(base) # :nodoc:
|
7
7
|
base.extend ClassMethods
|
8
8
|
base.send :include, InstanceMethods
|
9
9
|
base.class_eval do
|
10
|
-
helper_method :errors_for, :is_bot
|
10
|
+
helper_method :errors_for, :is_bot?, :bot_id
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -17,7 +17,11 @@ module Preciousss
|
|
17
17
|
module InstanceMethods
|
18
18
|
|
19
19
|
def is_bot?
|
20
|
-
@is_bot ||=
|
20
|
+
@is_bot ||= !bot_id.blank?
|
21
|
+
end
|
22
|
+
|
23
|
+
def bot_id
|
24
|
+
@bot_id ||= (request.user_agent.to_s =~ BOTS_REGEXP) && $1
|
21
25
|
end
|
22
26
|
|
23
27
|
def errors_for(*params)
|
data/lib/preciousss/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: preciousss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- sodercober
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-03-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-03-18 00:00:00.000000000 +00:00
|
13
|
+
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: Several helpers for Ruby on Rails 3
|
16
16
|
email:
|
@@ -33,7 +33,7 @@ files:
|
|
33
33
|
has_rdoc: true
|
34
34
|
homepage: https://github.com/sodercober/preciousss
|
35
35
|
licenses: []
|
36
|
-
post_install_message:
|
36
|
+
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
@@ -51,8 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project: preciousss
|
54
|
-
rubygems_version: 1.
|
55
|
-
signing_key:
|
54
|
+
rubygems_version: 1.6.1
|
55
|
+
signing_key:
|
56
56
|
specification_version: 3
|
57
57
|
summary: Several helpers for Ruby on Rails 3
|
58
58
|
test_files: []
|