class Restspec::Schema::Types::BooleanType

Public Instance Methods

example_for(attribute) click to toggle source

Generates an example boolean.

@param attribute [Restspec::Schema::Attribute] the atribute of the schema. @return [true, false] One of `true` and `false`, randomly.

# File lib/restspec/schema/types/boolean_type.rb, line 7
def example_for(attribute)
  [true, false].sample
end
valid?(attribute, value) click to toggle source

Validates is the value is a boolean.

@param attribute [Restspec::Schema::Attribute] the atribute of the schema. @param value [Object] the value of the attribute.

@return [true, false] If the value is one of true and false.

# File lib/restspec/schema/types/boolean_type.rb, line 17
def valid?(attribute, value)
  [true, false].include?(value)
end