Class: Restspec::Schema::Types::OneOfType
- Inherits:
-
BasicType
- Object
- BasicType
- Restspec::Schema::Types::OneOfType
show all
- Defined in:
- lib/restspec/schema/types/one_of_type.rb
Instance Method Summary
collapse
Methods inherited from BasicType
#initialize, #of, #totally_valid?, #|
Instance Method Details
#example_for(attribute) ⇒ Object
3
4
5
|
# File 'lib/restspec/schema/types/one_of_type.rb', line 3
def example_for(attribute)
elements.sample
end
|
#to_s ⇒ Object
11
12
13
|
# File 'lib/restspec/schema/types/one_of_type.rb', line 11
def to_s
"OneOfType(#{elements})"
end
|
#valid?(attribute, value) ⇒ Boolean
7
8
9
|
# File 'lib/restspec/schema/types/one_of_type.rb', line 7
def valid?(attribute, value)
elements.include?(value)
end
|