humanizer 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,14 +1,20 @@
1
+ ### Humanizer 2.2.0 (2010-11-18)
2
+
3
+ Added translations: French, Russian.
4
+ Added real_human attribute to skip validation.
5
+
6
+
1
7
  ### Humanizer 2.1.1 (2010-09-09)
2
8
 
3
- Updated changelog
9
+ Updated changelog.
4
10
 
5
11
 
6
12
  ### Humanizer 2.1.0 (2010-09-09)
7
13
 
8
- Minor polishing
9
- Support for Formtastic inline errors
10
- Added flexibility to validations
11
- Added translations: Dutch, Brazilian Portuguese
14
+ Minor polishing.
15
+ Support for Formtastic inline errors.
16
+ Added flexibility to validations.
17
+ Added translations: Dutch, Brazilian Portuguese.
12
18
 
13
19
 
14
20
  ### Humanizer 2.0.0 (2010-06-30)
data/README.md CHANGED
@@ -34,6 +34,10 @@ Default translations can be found in config/locales/
34
34
 
35
35
  You might want to add/change question and answer pairs. This can be easily done by adding/modifying entries in locales file.
36
36
 
37
+ ## Skipping validation
38
+
39
+ Set the attribute 'real_human' to true on the object you want to skip the Humanizer validation. Handy for testing or console use.
40
+
37
41
  ## Live sites
38
42
 
39
43
  * [ArcticStartup.com](http://arcticstartup.com/) - signup form
@@ -48,6 +52,7 @@ Humanizer is licensed under the MIT License, for more details see the LICENSE fi
48
52
  * German by [Sven Schwyn](http://github.com/svoop)
49
53
  * Dutch by [Joren De Groof](http://github.com/joren)
50
54
  * Brazilian Portuguese by [Britto](http://github.com/britto)
55
+ * Russian by [Shark](http://github.com/Serheo)
51
56
 
52
57
  ## Contributors
53
58
 
@@ -0,0 +1,43 @@
1
+ fr:
2
+ humanizer:
3
+ validation:
4
+ error: Vous n'êtes pas humain
5
+ questions:
6
+ - question: Deux plus deux font?
7
+ answers: ["4", "quatre"]
8
+ - question: "Liberté, Égalité,..."
9
+ answer: fraternité
10
+ - question: Quel est le chiffre qui précède douze?
11
+ answers: ["11", "onze"]
12
+ - question: Cinq fois deux font?
13
+ answers: ["10", "dix"]
14
+ - question: "Quel chiffre qui suivra? 10, 11, 12, 13, 14, .."
15
+ answers: ["15", "quinze"]
16
+ - question: "Cinq fois cinq ne font pas dix mais?"
17
+ answers: ["25", "vingt-cinq"]
18
+ - question: "Dix divisé par deux fait?"
19
+ answers: ["5", "cinq"]
20
+ - question: Le jour de la semaine qui succède au dimanche est le...?
21
+ answer: ["lundi", "le lundi"]
22
+ - question: Quel est le dernier mois de l'année'?
23
+ answer: "décembre"
24
+ - question: L'heure correspond à combien de minutes?
25
+ answers: ["60", "soixante"]
26
+ - question: Le contraire de 'haut' est?
27
+ answer: "bas"
28
+ - question: Le sens inverse du Nord?
29
+ answer: ["sud", "le sud"]
30
+ - question: Quel est le contraire du bien?
31
+ answer: ["mal", "le mal"]
32
+ - question: Que font 4 fois quatre?
33
+ answers: ["16", "seize"]
34
+ - question: Quel chiffre suit 20?
35
+ answers: ["21", "vingt-et-un"]
36
+ - question: Quel mois précède Juillet?
37
+ answer: "juin"
38
+ - question: Quinze divisé par 3 font?
39
+ answer: ["cinq", "5"]
40
+ - question: Quatorze moins 4 font?
41
+ answers: ["10", "dix"]
42
+ - question: "Le suivant est? lundi, mardi, mercredi.."
43
+ answer: "jeudi"
@@ -0,0 +1,43 @@
1
+ ru:
2
+ humanizer:
3
+ validation:
4
+ error: Вы робот
5
+ questions:
6
+ - question: Два плюс два?
7
+ answers: ["4", "четыре"]
8
+ - question: В лесу родилась...
9
+ answer: елочка
10
+ - question: Какое число идет до девяти?
11
+ answers: ["8", "восемь"]
12
+ - question: Пять раз по два?
13
+ answers: ["10", "десять"]
14
+ - question: "Продолжите последовательность: 10, 11, 12, 13, 14, .."
15
+ answers: ["15", "пятьнадцать"]
16
+ - question: "Пять раз по пять?"
17
+ answers: ["25", "двадцать пять"]
18
+ - question: "Десять делить на два?"
19
+ answers: ["5", "пять"]
20
+ - question: Какой день идет после понедельника?
21
+ answer: "вторник"
22
+ - question: Какой последний месяц в году?
23
+ answer: "декабрь"
24
+ - question: Сколько минут в одном часе?
25
+ answers: ["60", "шестьдесят"]
26
+ - question: Слово обратное слову Вниз?
27
+ answer: "вверх"
28
+ - question: Слово обратное слову Север?
29
+ answer: "юг"
30
+ - question: Слово обратное слову Плохой?
31
+ answer: "хороший"
32
+ - question: Четыре раза по четыре?
33
+ answers: ["16", "шестнадцать"]
34
+ - question: Какое число идет после 20?
35
+ answers: ["21", "двадцать один"]
36
+ - question: Месяц идущий перед Июлем?
37
+ answer: "июнь"
38
+ - question: Пятнадцать делить на три?
39
+ answer: ["пять", "5"]
40
+ - question: 14 минус 4?
41
+ answers: ["10", "десять"]
42
+ - question: "Продолжите. Понедельник, Вторник, Среда.."
43
+ answer: "четверг"
data/lib/humanizer.rb CHANGED
@@ -4,7 +4,7 @@ module Humanizer
4
4
  base.extend(ClassMethods)
5
5
  end
6
6
 
7
- attr_accessor :humanizer_answer
7
+ attr_accessor :humanizer_answer, :real_human
8
8
  attr_writer :humanizer_question_id
9
9
 
10
10
  def humanizer_question
@@ -37,8 +37,8 @@ module Humanizer
37
37
  module ClassMethods
38
38
 
39
39
  def require_human_on(validate_on, opts = {})
40
- opts[:on] = validate_on
41
- validate :humanizer_check_answer, opts
40
+ validates :humanizer_check_answer, :presence => {:on => validate_on,
41
+ :unless => proc {|obj| obj.real_human}}
42
42
  end
43
43
 
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Humanizer
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 1
8
- - 1
9
- version: 2.1.1
7
+ - 2
8
+ - 0
9
+ version: 2.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Antti Akonniemi
@@ -15,11 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-09 00:00:00 +03:00
18
+ date: 2010-11-18 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: bundler
23
+ prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
@@ -31,10 +32,10 @@ dependencies:
31
32
  - 0
32
33
  version: 1.0.0
33
34
  type: :development
34
- prerelease: false
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
+ prerelease: false
38
39
  requirement: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
@@ -44,10 +45,10 @@ dependencies:
44
45
  - 0
45
46
  version: "0"
46
47
  type: :development
47
- prerelease: false
48
48
  version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rspec
51
+ prerelease: false
51
52
  requirement: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
@@ -60,10 +61,10 @@ dependencies:
60
61
  - beta
61
62
  version: 2.0.0.beta
62
63
  type: :development
63
- prerelease: false
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: rails
67
+ prerelease: false
67
68
  requirement: &id004 !ruby/object:Gem::Requirement
68
69
  none: false
69
70
  requirements:
@@ -75,7 +76,6 @@ dependencies:
75
76
  - 0
76
77
  version: 3.0.0
77
78
  type: :development
78
- prerelease: false
79
79
  version_requirements: *id004
80
80
  description: reCAPTCHA was too much for us, so we created this. Simplest captcha ever.
81
81
  email:
@@ -97,9 +97,11 @@ files:
97
97
  - lib/generators/templates/locales/de.yml
98
98
  - lib/generators/templates/locales/en.yml
99
99
  - lib/generators/templates/locales/fi.yml
100
+ - lib/generators/templates/locales/fr.yml
100
101
  - lib/generators/templates/locales/nl.yml
101
102
  - lib/generators/templates/locales/pt-BR.yml
102
103
  - lib/generators/templates/locales/pt-PT.yml
104
+ - lib/generators/templates/locales/ru.yml
103
105
  has_rdoc: true
104
106
  homepage: http://github.com/kiskolabs/humanizer
105
107
  licenses: []
@@ -114,7 +116,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
116
  requirements:
115
117
  - - ">="
116
118
  - !ruby/object:Gem::Version
117
- hash: -1206748496174217247
118
119
  segments:
119
120
  - 0
120
121
  version: "0"