gotcha 0.0.5 → 0.0.6
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/lib/gotcha.rb +10 -0
- data/lib/gotcha/controller_helpers.rb +1 -0
- data/lib/gotcha/form_helpers.rb +4 -2
- data/lib/gotcha/version.rb +1 -1
- metadata +36 -60
data/lib/gotcha.rb
CHANGED
@@ -22,6 +22,16 @@ module Gotcha
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# Whether or not to skip validation
|
26
|
+
def self.skip_validation?
|
27
|
+
@skip_validation || false
|
28
|
+
end
|
29
|
+
|
30
|
+
# Set whether or not to skip validation
|
31
|
+
def self.skip_validation=(val)
|
32
|
+
@skip_validation = !!val
|
33
|
+
end
|
34
|
+
|
25
35
|
def self.random_type
|
26
36
|
@gotcha_types.respond_to?(:sample) ? @gotcha_types.sample : @gotcha_types[rand(@gotcha_types.size)]
|
27
37
|
end
|
data/lib/gotcha/form_helpers.rb
CHANGED
@@ -3,10 +3,12 @@ module Gotcha
|
|
3
3
|
module FormHelpers
|
4
4
|
|
5
5
|
# Propose a gotcha to the user - question and answer hash
|
6
|
-
def gotcha
|
6
|
+
def gotcha(options = {})
|
7
|
+
options[:label_options] ||= {}
|
8
|
+
options[:text_field_options] ||= {}
|
7
9
|
if gotcha = Gotcha.random
|
8
10
|
field = "gotcha_response[#{gotcha.class.name.to_s}-#{Digest::MD5.hexdigest(gotcha.class.down_transform(gotcha.answer))}]"
|
9
|
-
(label_tag field, gotcha.question) + "\n" + (text_field_tag field)
|
11
|
+
(label_tag field, gotcha.question, options[:label_options]) + "\n" + (text_field_tag field, nil, options[:text_field_options])
|
10
12
|
else
|
11
13
|
raise "No Gotchas Installed"
|
12
14
|
end
|
data/lib/gotcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,60 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotcha
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- John Crepezzi
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-04-13 00:00:00 -04:00
|
12
|
+
date: 2011-08-25 00:00:00.000000000 -04:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: rspec
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2161836440 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
33
23
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: actionpack
|
37
24
|
prerelease: false
|
38
|
-
|
25
|
+
version_requirements: *2161836440
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: actionpack
|
28
|
+
requirement: &2161836020 !ruby/object:Gem::Requirement
|
39
29
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
47
34
|
type: :development
|
48
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2161836020
|
49
37
|
description: A smart captcha library
|
50
38
|
email: john.crepezzi@patch.com
|
51
39
|
executables: []
|
52
|
-
|
53
40
|
extensions: []
|
54
|
-
|
55
41
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
files:
|
42
|
+
files:
|
58
43
|
- lib/gotcha/base.rb
|
59
44
|
- lib/gotcha/controller_helpers.rb
|
60
45
|
- lib/gotcha/form_helpers.rb
|
@@ -67,36 +52,27 @@ files:
|
|
67
52
|
has_rdoc: true
|
68
53
|
homepage: http://seejohnrun.github.com/gotcha/
|
69
54
|
licenses: []
|
70
|
-
|
71
55
|
post_install_message:
|
72
56
|
rdoc_options: []
|
73
|
-
|
74
|
-
require_paths:
|
57
|
+
require_paths:
|
75
58
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
60
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
- 0
|
84
|
-
version: "0"
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
66
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
94
71
|
requirements: []
|
95
|
-
|
96
72
|
rubyforge_project: gotcha
|
97
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.6.2
|
98
74
|
signing_key:
|
99
75
|
specification_version: 3
|
100
76
|
summary: A captcha library for auto-generating questions
|
101
|
-
test_files:
|
77
|
+
test_files:
|
102
78
|
- spec/spec_helper.rb
|