lib/fakeit/openapi/example/string_example.rb in fakeit-0.7.1 vs lib/fakeit/openapi/example/string_example.rb in fakeit-0.8.0

- old
+ new

@@ -63,46 +63,30 @@ elsif length_constraint then string_with_length else Faker::Book.title end end - def static_string_with_length - '1' * max_string_length - end + def static_string_with_length = '1' * max_string_length - def static_string_format - (STATIC_FORMAT_HANDLERS[format] || method(:unknown_format))[] - end + def static_string_format = (STATIC_FORMAT_HANDLERS[format] || method(:unknown_format))[] def static_string_pattern @static_string_pattern ||= @string_pattern.examples( max_repeater_variance: 1, max_group_results: 1, max_results_limit: 1 ).first end - def length_constraint - minLength || maxLength - end + def length_constraint = minLength || maxLength - def string_with_length - Faker::Internet.username(specifier: min_string_length..max_string_length) - end + def string_with_length = Faker::Internet.username(specifier: min_string_length..max_string_length) - def min_string_length - minLength || 0 - end + def min_string_length = minLength || 0 - def max_string_length - maxLength || min_string_length + 10 - end + def max_string_length = maxLength || min_string_length + 10 - def random_string_format - (RANDOM_FORMAT_HANDLERS[format] || method(:unknown_format))[] - end + def random_string_format = (RANDOM_FORMAT_HANDLERS[format] || method(:unknown_format))[] - def random_string_pattern - @random_string_pattern ||= @string_pattern.random_example(max_repeater_variance: 1) - end + def random_string_pattern = @random_string_pattern ||= @string_pattern.random_example(max_repeater_variance: 1) def unknown_format Logger.info("Unknown string format: #{format}") 'Unknown string format' end