module SimpleForm::Components::Pattern
Needs to be enabled in order to do automatic lookups.
Public Instance Methods
pattern(wrapper_options = nil)
click to toggle source
# File lib/simple_form/components/pattern.rb, line 6 def pattern(wrapper_options = nil) input_html_options[:pattern] ||= pattern_source nil end
Private Instance Methods
evaluate_format_validator_option(option)
click to toggle source
# File lib/simple_form/components/pattern.rb, line 26 def evaluate_format_validator_option(option) if option.respond_to?(:call) option.call(object) else option end end
find_pattern_validator()
click to toggle source
# File lib/simple_form/components/pattern.rb, line 22 def find_pattern_validator find_validator(:format) end
pattern_source()
click to toggle source
# File lib/simple_form/components/pattern.rb, line 13 def pattern_source pattern = options[:pattern] if pattern.is_a?(String) pattern elsif (pattern_validator = find_pattern_validator) && (with = pattern_validator.options[:with]) evaluate_format_validator_option(with).source end end