Class: SoberSwag::Reporting::Input::Text
- Inherits:
-
Base
- Object
- Base
- SoberSwag::Reporting::Input::Text
show all
- Includes:
- Comparable
- Defined in:
- lib/sober_swag/reporting/input/text.rb
Overview
Input for a single text value.
Instance Method Summary
collapse
Methods included from Interface
#add_schema_key, #call!, #described, #enum, #format, #in_range, #list, #mapped, #modify_schema, #multiple_of, #optional, #or, #referenced, #swagger_path_schema, #swagger_query_schema, #|
Instance Method Details
#<=>(other) ⇒ Object
28
29
30
|
# File 'lib/sober_swag/reporting/input/text.rb', line 28
def <=>(other)
eql?(other) ? 0 : 1
end
|
#call(value) ⇒ Object
7
8
9
10
11
|
# File 'lib/sober_swag/reporting/input/text.rb', line 7
def call(value)
return value if value.is_a?(String)
Report::Value.new(['was not a string'])
end
|
#eql?(other) ⇒ Boolean
24
25
26
|
# File 'lib/sober_swag/reporting/input/text.rb', line 24
def eql?(other)
other.class == self.class
end
|
32
33
34
|
# File 'lib/sober_swag/reporting/input/text.rb', line 32
def hash
[self.class.hash, 1].hash
end
|
#swagger_schema ⇒ Object
36
37
38
|
# File 'lib/sober_swag/reporting/input/text.rb', line 36
def swagger_schema
[{ type: 'string' }, {}]
end
|
#with_pattern(regexp) ⇒ Pattern
Get a new input value which requires a regexp.
18
19
20
|
# File 'lib/sober_swag/reporting/input/text.rb', line 18
def with_pattern(regexp)
Pattern.new(self, regexp)
end
|