Class: Restspec::Schema::Types::StringType

Inherits:
BasicType
  • Object
show all
Defined in:
lib/restspec/schema/types/string_type.rb

Instance Method Summary collapse

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) ⇒ String

Generates a random word.

Parameters:

Returns:

  • (String)

    A random word.



8
9
10
# File 'lib/restspec/schema/types/string_type.rb', line 8

def example_for(attribute)
  Faker::Lorem.word
end

#valid?(attribute, value) ⇒ true, false

Returns If the value is a string.

Parameters:

Returns:

  • (true, false)

    If the value is a string.



16
17
18
# File 'lib/restspec/schema/types/string_type.rb', line 16

def valid?(attribute, value)
  value.is_a?(String)
end