Class: Restspec::Schema::Types::BooleanType
- Defined in:
- lib/restspec/schema/types/boolean_type.rb
Instance Method Summary collapse
-
#example_for(attribute) ⇒ true, false
Generates an example boolean.
-
#valid?(attribute, value) ⇒ true, false
Validates is the value is a boolean.
Methods inherited from BasicType
#initialize, #of, #to_s, #totally_valid?, #|
Constructor Details
This class inherits a constructor from Restspec::Schema::Types::BasicType
Instance Method Details
#example_for(attribute) ⇒ true, false
Generates an example boolean.
7 8 9 |
# File 'lib/restspec/schema/types/boolean_type.rb', line 7 def example_for(attribute) [true, false].sample end |
#valid?(attribute, value) ⇒ true, false
Validates is the value is a boolean.
17 18 19 |
# File 'lib/restspec/schema/types/boolean_type.rb', line 17 def valid?(attribute, value) [true, false].include?(value) end |