Module: MeadCaptcha
- Defined in:
- lib/mead_captcha.rb,
lib/mead_captcha/engine.rb,
lib/mead_captcha/helpers.rb,
lib/mead_captcha/version.rb,
lib/mead_captcha/configuration.rb
Defined Under Namespace
Modules: Helpers
Classes: Configuration, Engine
Constant Summary
collapse
- VERSION =
"1.0.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
16
17
18
|
# File 'lib/mead_captcha.rb', line 16
def configuration
@configuration
end
|
Class Method Details
23
24
25
26
27
|
# File 'lib/mead_captcha.rb', line 23
def self.configure
yield(configuration)
ActionController::Base.send(:include, MeadCaptcha) if defined?(ActionController::Base)
end
|
.included(base) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/mead_captcha.rb', line 29
def self.included(base)
helper_methods = self.protected_instance_methods
base.send :helper_method, helper_methods
if base.respond_to? :before_action
base.send :prepend_before_action, :on_honeypot_failure, self.protect_controller_actions
elsif base.respond_to? :before_filter
base.send :prepend_before_filter, :on_honeypot_failure, self.protect_controller_actions
end
end
|
.protect_controller_actions ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/mead_captcha.rb', line 42
def self.protect_controller_actions
options = {}
if configuration.protect_controller_actions.present?
options[:only] = configuration.protect_controller_actions
elsif configuration.ignore_controller_actions.present?
options[:except] = configuration.ignore_controller_actions
end
options
end
|