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 CHANGED
@@ -14,3 +14,4 @@ Validators
14
14
  ----------
15
15
 
16
16
  email_format
17
+ collection_length
@@ -1,13 +1,13 @@
1
1
  module Preciousss
2
2
  module Controllers
3
3
  module Helpers
4
- BOTS_REGEXP = /Googlebot|facebookexternalhit/i.freeze
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 ||= request.user_agent.to_s =~ BOTS_REGEXP
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)
@@ -1,3 +1,3 @@
1
1
  module Preciousss
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
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.7
5
- prerelease: !!null
4
+ version: 0.0.8
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - sodercober
9
- autorequire: !!null
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-03-08 00:00:00.000000000 +00:00
13
- default_executable: !!null
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: !!null
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.5.0
55
- signing_key: !!null
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: []