Module: CaringForm::Dsl::ClassMethods
- Defined in:
- lib/caring_form/dsl.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/caring_form/dsl.rb', line 76
def method_missing(meth, *args, &blk)
if CaringForm::FieldContainer::field_for(meth)
singleton = (class << self; self; end)
singleton.send(:define_method, meth) do |*meth_args|
options = meth_args..merge(:type => meth)
meth_args << nil if meth_args.empty? field(*(meth_args << options))
end
send(meth, *args)
else
super
end
end
|
Instance Method Details
#can_check_spam? ⇒ Boolean
61
62
63
|
# File 'lib/caring_form/dsl.rb', line 61
def can_check_spam?
@can_check_spam == true
end
|
#error_config ⇒ Object
69
70
71
72
73
74
|
# File 'lib/caring_form/dsl.rb', line 69
def error_config
@error_config ||= {
:header => "Sorry, this operation failed",
:message => "Please fix the errors below and try again."
}
end
|
#on_error(options = {}) ⇒ Object
65
66
67
|
# File 'lib/caring_form/dsl.rb', line 65
def on_error(options = {})
@error_config = options.slice(:header, :message)
end
|
#protect_from_bots ⇒ Object
56
57
58
59
|
# File 'lib/caring_form/dsl.rb', line 56
def protect_from_bots
dummy(:reference, :ancillary => true)
@can_check_spam = true
end
|