class SoberSwag::Reporting::Input::Text

Input for a single text value.

Public Instance Methods

<=>(other) click to toggle source
# File lib/sober_swag/reporting/input/text.rb, line 28
def <=>(other)
  eql?(other) ? 0 : 1
end
call(value) click to toggle source
# 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) click to toggle source
# File lib/sober_swag/reporting/input/text.rb, line 24
def eql?(other)
  other.class == self.class
end
hash() click to toggle source
# File lib/sober_swag/reporting/input/text.rb, line 32
def hash
  [self.class.hash, 1].hash
end
swagger_schema() click to toggle source
# File lib/sober_swag/reporting/input/text.rb, line 36
def swagger_schema
  [{ type: 'string' }, {}]
end
with_pattern(regexp) click to toggle source

Get a new input value which requires a regexp.

@paran regexp [Regexp] regular expression to match on @return [Pattern] pattern-based input.

# File lib/sober_swag/reporting/input/text.rb, line 18
def with_pattern(regexp)
  Pattern.new(self, regexp)
end