Class: Sinatra::Chiro::Parameters::RegexpValidator
- Inherits:
-
Base
- Object
- Base
- Sinatra::Chiro::Parameters::RegexpValidator
show all
- Defined in:
- lib/sinatra/chiro/parameters/regexp.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#default, #description, #initialize, #name, #name_display, #optional, #type
Instance Method Details
14
15
16
|
# File 'lib/sinatra/chiro/parameters/regexp.rb', line 14
def
"#{options[:comment]}"
end
|
#type_description ⇒ Object
10
11
12
|
# File 'lib/sinatra/chiro/parameters/regexp.rb', line 10
def type_description
super || "Regexp"
end
|
#validate(given) ⇒ Object
6
7
8
|
# File 'lib/sinatra/chiro/parameters/regexp.rb', line 6
def validate(given)
"#{name_display} parameter should match regexp: #{options[:type]}" if given[name] !~ options[:type]
end
|